Commit aee80b54 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

ipv6: generate link local address for GRE tunnel

Use same logic as SIT tunnel to handle link local address
for GRE tunnel. OSPFv3 requires link-local address to function.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8ef207d6
...@@ -1559,6 +1559,11 @@ static int addrconf_ifid_sit(u8 *eui, struct net_device *dev) ...@@ -1559,6 +1559,11 @@ static int addrconf_ifid_sit(u8 *eui, struct net_device *dev)
return -1; return -1;
} }
static int addrconf_ifid_gre(u8 *eui, struct net_device *dev)
{
return __ipv6_isatap_ifid(eui, *(__be32 *)dev->dev_addr);
}
static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
{ {
switch (dev->type) { switch (dev->type) {
...@@ -1572,6 +1577,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) ...@@ -1572,6 +1577,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
return addrconf_ifid_infiniband(eui, dev); return addrconf_ifid_infiniband(eui, dev);
case ARPHRD_SIT: case ARPHRD_SIT:
return addrconf_ifid_sit(eui, dev); return addrconf_ifid_sit(eui, dev);
case ARPHRD_IPGRE:
return addrconf_ifid_gre(eui, dev);
} }
return -1; return -1;
} }
...@@ -2423,6 +2430,29 @@ static void addrconf_sit_config(struct net_device *dev) ...@@ -2423,6 +2430,29 @@ static void addrconf_sit_config(struct net_device *dev)
} }
#endif #endif
#if defined(CONFIG_NET_IPGRE) || defined(CONFIG_NET_IPGRE_MODULE)
static void addrconf_gre_config(struct net_device *dev)
{
struct inet6_dev *idev;
struct in6_addr addr;
pr_info("ipv6: addrconf_gre_config(%s)\n", dev->name);
ASSERT_RTNL();
if ((idev = ipv6_find_idev(dev)) == NULL) {
printk(KERN_DEBUG "init gre: add_dev failed\n");
return;
}
ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
addrconf_prefix_route(&addr, 64, dev, 0, 0);
if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
addrconf_add_linklocal(idev, &addr);
}
#endif
static inline int static inline int
ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev) ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev)
{ {
...@@ -2538,6 +2568,11 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, ...@@ -2538,6 +2568,11 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
case ARPHRD_SIT: case ARPHRD_SIT:
addrconf_sit_config(dev); addrconf_sit_config(dev);
break; break;
#endif
#if defined(CONFIG_NET_IPGRE) || defined(CONFIG_NET_IPGRE_MODULE)
case ARPHRD_IPGRE:
addrconf_gre_config(dev);
break;
#endif #endif
case ARPHRD_TUNNEL6: case ARPHRD_TUNNEL6:
addrconf_ip6_tnl_config(dev); addrconf_ip6_tnl_config(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment