Skip to content

Commit 45ce0fd

Browse files
felix-jiadavem330
authored andcommitted
net/ipv6: support more tunnel interfaces for EUI64 link-local generation
Signed-off-by: Felix Jia <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d35a00b commit 45ce0fd

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

net/ipv6/addrconf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,12 +2146,14 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
21462146
case ARPHRD_SIT:
21472147
return addrconf_ifid_sit(eui, dev);
21482148
case ARPHRD_IPGRE:
2149+
case ARPHRD_TUNNEL:
21492150
return addrconf_ifid_gre(eui, dev);
21502151
case ARPHRD_6LOWPAN:
21512152
return addrconf_ifid_eui64(eui, dev);
21522153
case ARPHRD_IEEE1394:
21532154
return addrconf_ifid_ieee1394(eui, dev);
21542155
case ARPHRD_TUNNEL6:
2156+
case ARPHRD_IP6GRE:
21552157
return addrconf_ifid_ip6tnl(eui, dev);
21562158
}
21572159
return -1;
@@ -3195,6 +3197,9 @@ static void addrconf_dev_config(struct net_device *dev)
31953197
(dev->type != ARPHRD_IEEE1394) &&
31963198
(dev->type != ARPHRD_TUNNEL6) &&
31973199
(dev->type != ARPHRD_6LOWPAN) &&
3200+
(dev->type != ARPHRD_IP6GRE) &&
3201+
(dev->type != ARPHRD_IPGRE) &&
3202+
(dev->type != ARPHRD_TUNNEL) &&
31983203
(dev->type != ARPHRD_NONE)) {
31993204
/* Alas, we support only Ethernet autoconfiguration. */
32003205
return;

net/ipv6/ip6_gre.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,9 @@ static void ip6gre_tunnel_setup(struct net_device *dev)
993993
dev->flags |= IFF_NOARP;
994994
dev->addr_len = sizeof(struct in6_addr);
995995
netif_keep_dst(dev);
996+
/* This perm addr will be used as interface identifier by IPv6 */
997+
dev->addr_assign_type = NET_ADDR_RANDOM;
998+
eth_random_addr(dev->perm_addr);
996999
}
9971000

9981001
static int ip6gre_tunnel_init_common(struct net_device *dev)

net/ipv6/ip6_vti.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <net/xfrm.h>
5050
#include <net/net_namespace.h>
5151
#include <net/netns/generic.h>
52+
#include <linux/etherdevice.h>
5253

5354
#define IP6_VTI_HASH_SIZE_SHIFT 5
5455
#define IP6_VTI_HASH_SIZE (1 << IP6_VTI_HASH_SIZE_SHIFT)
@@ -842,6 +843,9 @@ static void vti6_dev_setup(struct net_device *dev)
842843
dev->flags |= IFF_NOARP;
843844
dev->addr_len = sizeof(struct in6_addr);
844845
netif_keep_dst(dev);
846+
/* This perm addr will be used as interface identifier by IPv6 */
847+
dev->addr_assign_type = NET_ADDR_RANDOM;
848+
eth_random_addr(dev->perm_addr);
845849
}
846850

847851
/**

0 commit comments

Comments
 (0)