diff mbox

net: modify tunnel's name when changing link's name

Message ID CAHA+R7PUF0Bh-fmJGiNx37-O7Nig2FxMON88pNcZPWPCJ7_CKA@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Cong Wang May 22, 2014, 5:56 a.m. UTC
On Wed, May 21, 2014 at 9:12 PM, Cong Wang <cwang@twopensource.com> wrote:
> On Tue, May 20, 2014 at 5:19 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> On Tue, 2014-05-20 at 16:20 -0700, Cong Wang wrote:
>>> On Tue, May 20, 2014 at 12:21 PM, Cong Wang <cwang@twopensource.com> wrote:
>>> >
>>> > I am working on a patch.
>>>
>>> For now, I think we just fix the renaming issue.
>>> Please try this patch below (I already tested it actually).
>>>
>>> IPv6 part is on the way.
>>
>> This looks like bloat.
>>
>> Why do we need to copy dev->name into tunnel->param.name ?
>>
>> struct ip_tunnel_parm is legacy, but we do not need to store
>> anything in tunnel->param.name
>>
>> This can be filled when/if sent to userland.
>>
>>
>
> Yeah, that should work as well, it's a even quicker fix.
>
> I think we will need a notifier for tunnels anyway, for example, when
> the lower device (iflink) gets unregistered.

Or a even quicker fix:

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 289c6ee..e1dce3b 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -735,6 +735,8 @@  int ip_tunnel_ioctl(struct net_device *dev, struct
ip_tunnel_parm *p, int cmd)
                        if (t == NULL)
                                t = netdev_priv(dev);
                }
+               /* Device name might have been changed */
+               strlcpy(t->parms.name, t->dev->name, IFNAMSIZ);
                memcpy(p, &t->parms, sizeof(*p));
                break;