forked from Minki/linux
sit: Use ipip6_tunnel_init as the ndo_init function.
ipip6_tunnel_init() sets the dev->iflink via a call to ipip6_tunnel_bind_dev(). After that, register_netdevice() sets dev->iflink = -1. So we loose the iflink configuration for ipv6 tunnels. Fix this by using ipip6_tunnel_init() as the ndo_init function. Then ipip6_tunnel_init() is called after dev->iflink is set to -1 from register_netdevice(). Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
16a0231bf7
commit
ebe084aafb
@ -195,10 +195,8 @@ static int ipip6_tunnel_create(struct net_device *dev)
|
|||||||
struct sit_net *sitn = net_generic(net, sit_net_id);
|
struct sit_net *sitn = net_generic(net, sit_net_id);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = ipip6_tunnel_init(dev);
|
memcpy(dev->dev_addr, &t->parms.iph.saddr, 4);
|
||||||
if (err < 0)
|
memcpy(dev->broadcast, &t->parms.iph.daddr, 4);
|
||||||
goto out;
|
|
||||||
ipip6_tunnel_clone_6rd(dev, sitn);
|
|
||||||
|
|
||||||
if ((__force u16)t->parms.i_flags & SIT_ISATAP)
|
if ((__force u16)t->parms.i_flags & SIT_ISATAP)
|
||||||
dev->priv_flags |= IFF_ISATAP;
|
dev->priv_flags |= IFF_ISATAP;
|
||||||
@ -207,7 +205,8 @@ static int ipip6_tunnel_create(struct net_device *dev)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
strcpy(t->parms.name, dev->name);
|
ipip6_tunnel_clone_6rd(dev, sitn);
|
||||||
|
|
||||||
dev->rtnl_link_ops = &sit_link_ops;
|
dev->rtnl_link_ops = &sit_link_ops;
|
||||||
|
|
||||||
dev_hold(dev);
|
dev_hold(dev);
|
||||||
@ -1330,6 +1329,7 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct net_device_ops ipip6_netdev_ops = {
|
static const struct net_device_ops ipip6_netdev_ops = {
|
||||||
|
.ndo_init = ipip6_tunnel_init,
|
||||||
.ndo_uninit = ipip6_tunnel_uninit,
|
.ndo_uninit = ipip6_tunnel_uninit,
|
||||||
.ndo_start_xmit = sit_tunnel_xmit,
|
.ndo_start_xmit = sit_tunnel_xmit,
|
||||||
.ndo_do_ioctl = ipip6_tunnel_ioctl,
|
.ndo_do_ioctl = ipip6_tunnel_ioctl,
|
||||||
@ -1378,9 +1378,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
|
|||||||
|
|
||||||
tunnel->dev = dev;
|
tunnel->dev = dev;
|
||||||
tunnel->net = dev_net(dev);
|
tunnel->net = dev_net(dev);
|
||||||
|
strcpy(tunnel->parms.name, dev->name);
|
||||||
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
|
|
||||||
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
|
|
||||||
|
|
||||||
ipip6_tunnel_bind_dev(dev);
|
ipip6_tunnel_bind_dev(dev);
|
||||||
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
|
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
|
||||||
@ -1405,7 +1403,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
|
|||||||
|
|
||||||
tunnel->dev = dev;
|
tunnel->dev = dev;
|
||||||
tunnel->net = dev_net(dev);
|
tunnel->net = dev_net(dev);
|
||||||
strcpy(tunnel->parms.name, dev->name);
|
|
||||||
|
|
||||||
iph->version = 4;
|
iph->version = 4;
|
||||||
iph->protocol = IPPROTO_IPV6;
|
iph->protocol = IPPROTO_IPV6;
|
||||||
|
Loading…
Reference in New Issue
Block a user