Skip to content

Commit e0c9394

Browse files
yoshfujidavem330
authored andcommitted
ipv6 sit: Ensure to initialize 6rd parameters.
ipv6 sit: Ensure to initialize 6rd parameters. Signed-off-by: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 71034ba commit e0c9394

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/ipv6/sit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ static void ipip6_tunnel_link(struct sit_net *sitn, struct ip_tunnel *t)
161161
write_unlock_bh(&ipip6_lock);
162162
}
163163

164-
static void ipip6_tunnel_clone_6rd(struct ip_tunnel *t, struct sit_net *sitn)
164+
static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn)
165165
{
166166
#ifdef CONFIG_IPV6_SIT_6RD
167+
struct ip_tunnel *t = netdev_priv(dev);
168+
167169
if (t->dev == sitn->fb_tunnel_dev) {
168170
ipv6_addr_set(&t->ip6rd.prefix, htonl(0x20020000), 0, 0, 0);
169171
t->ip6rd.relay_prefix = 0;
@@ -219,6 +221,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct net *net,
219221

220222
nt->parms = *parms;
221223
ipip6_tunnel_init(dev);
224+
ipip6_tunnel_clone_6rd(dev, sitn);
222225

223226
if (parms->i_flags & SIT_ISATAP)
224227
dev->priv_flags |= IFF_ISATAP;
@@ -228,8 +231,6 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct net *net,
228231

229232
dev_hold(dev);
230233

231-
ipip6_tunnel_clone_6rd(t, sitn);
232-
233234
ipip6_tunnel_link(sitn, nt);
234235
return nt;
235236

@@ -1024,7 +1025,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
10241025
t->ip6rd.prefixlen = ip6rd.prefixlen;
10251026
t->ip6rd.relay_prefixlen = ip6rd.relay_prefixlen;
10261027
} else
1027-
ipip6_tunnel_clone_6rd(t, sitn);
1028+
ipip6_tunnel_clone_6rd(dev, sitn);
10281029

10291030
err = 0;
10301031
break;
@@ -1148,6 +1149,7 @@ static int sit_init_net(struct net *net)
11481149
dev_net_set(sitn->fb_tunnel_dev, net);
11491150

11501151
ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
1152+
ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
11511153

11521154
if ((err = register_netdev(sitn->fb_tunnel_dev)))
11531155
goto err_reg_dev;

0 commit comments

Comments
 (0)