Skip to content

Commit 74235a2

Browse files
herbertxdavem330
authored andcommitted
[IPV6] addrconf: Fix IPv6 on tuntap tunnels
The recent patch that added ipv6_hwtype is broken on tuntap tunnels. Indeed, it's broken on any device that does not pass the ipv6_hwtype test. The reason is that the original test only applies to autoconfiguration, not IPv6 support. IPv6 support is allowed on any device. In fact, even with the ipv6_hwtype patch applied you can still add IPv6 addresses to any interface that doesn't pass thw ipv6_hwtype test provided that they have a sufficiently large MTU. This is a serious problem because come deregistration time these devices won't be cleaned up properly. I've gone back and looked at the rationale for the patch. It appears that the real problem is that we were creating IPv6 devices even if the MTU was too small. So here's a patch which fixes that and reverts the ipv6_hwtype stuff. Thanks to Kanru Chen for reporting this issue. Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d7ea5b9 commit 74235a2

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

net/ipv6/addrconf.c

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,15 @@ static void addrconf_dev_config(struct net_device *dev)
21542154

21552155
ASSERT_RTNL();
21562156

2157+
if ((dev->type != ARPHRD_ETHER) &&
2158+
(dev->type != ARPHRD_FDDI) &&
2159+
(dev->type != ARPHRD_IEEE802_TR) &&
2160+
(dev->type != ARPHRD_ARCNET) &&
2161+
(dev->type != ARPHRD_INFINIBAND)) {
2162+
/* Alas, we support only Ethernet autoconfiguration. */
2163+
return;
2164+
}
2165+
21572166
idev = addrconf_add_dev(dev);
21582167
if (idev == NULL)
21592168
return;
@@ -2241,36 +2250,16 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
22412250
ip6_tnl_add_linklocal(idev);
22422251
}
22432252

2244-
static int ipv6_hwtype(struct net_device *dev)
2245-
{
2246-
if ((dev->type == ARPHRD_ETHER) ||
2247-
(dev->type == ARPHRD_LOOPBACK) ||
2248-
(dev->type == ARPHRD_SIT) ||
2249-
(dev->type == ARPHRD_TUNNEL6) ||
2250-
(dev->type == ARPHRD_FDDI) ||
2251-
(dev->type == ARPHRD_IEEE802_TR) ||
2252-
(dev->type == ARPHRD_ARCNET) ||
2253-
(dev->type == ARPHRD_INFINIBAND))
2254-
return 1;
2255-
2256-
return 0;
2257-
}
2258-
22592253
static int addrconf_notify(struct notifier_block *this, unsigned long event,
22602254
void * data)
22612255
{
22622256
struct net_device *dev = (struct net_device *) data;
2263-
struct inet6_dev *idev;
2257+
struct inet6_dev *idev = __in6_dev_get(dev);
22642258
int run_pending = 0;
22652259

2266-
if (!ipv6_hwtype(dev))
2267-
return NOTIFY_OK;
2268-
2269-
idev = __in6_dev_get(dev);
2270-
22712260
switch(event) {
22722261
case NETDEV_REGISTER:
2273-
if (!idev) {
2262+
if (!idev && dev->mtu >= IPV6_MIN_MTU) {
22742263
idev = ipv6_add_dev(dev);
22752264
if (!idev)
22762265
printk(KERN_WARNING "IPv6: add_dev failed for %s\n",

0 commit comments

Comments
 (0)