aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-06-08 06:44:30 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-08 20:05:30 -0400
commitaee80b54b235d34d87b25dfbe32f0f0ffee1b544 (patch)
treee9433b3b4116a3575479f445eec4802d790645d9 /net/ipv6/addrconf.c
parent8ef207d63f8ecc0eae41cded066dd0e0ee170edf (diff)
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: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 498b927f68be..3e369425df58 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1559,6 +1559,11 @@ static int addrconf_ifid_sit(u8 *eui, struct net_device *dev)
1559 return -1; 1559 return -1;
1560} 1560}
1561 1561
1562static int addrconf_ifid_gre(u8 *eui, struct net_device *dev)
1563{
1564 return __ipv6_isatap_ifid(eui, *(__be32 *)dev->dev_addr);
1565}
1566
1562static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) 1567static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
1563{ 1568{
1564 switch (dev->type) { 1569 switch (dev->type) {
@@ -1572,6 +1577,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
1572 return addrconf_ifid_infiniband(eui, dev); 1577 return addrconf_ifid_infiniband(eui, dev);
1573 case ARPHRD_SIT: 1578 case ARPHRD_SIT:
1574 return addrconf_ifid_sit(eui, dev); 1579 return addrconf_ifid_sit(eui, dev);
1580 case ARPHRD_IPGRE:
1581 return addrconf_ifid_gre(eui, dev);
1575 } 1582 }
1576 return -1; 1583 return -1;
1577} 1584}
@@ -2423,6 +2430,29 @@ static void addrconf_sit_config(struct net_device *dev)
2423} 2430}
2424#endif 2431#endif
2425 2432
2433#if defined(CONFIG_NET_IPGRE) || defined(CONFIG_NET_IPGRE_MODULE)
2434static void addrconf_gre_config(struct net_device *dev)
2435{
2436 struct inet6_dev *idev;
2437 struct in6_addr addr;
2438
2439 pr_info("ipv6: addrconf_gre_config(%s)\n", dev->name);
2440
2441 ASSERT_RTNL();
2442
2443 if ((idev = ipv6_find_idev(dev)) == NULL) {
2444 printk(KERN_DEBUG "init gre: add_dev failed\n");
2445 return;
2446 }
2447
2448 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
2449 addrconf_prefix_route(&addr, 64, dev, 0, 0);
2450
2451 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
2452 addrconf_add_linklocal(idev, &addr);
2453}
2454#endif
2455
2426static inline int 2456static inline int
2427ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev) 2457ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev)
2428{ 2458{
@@ -2539,6 +2569,11 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2539 addrconf_sit_config(dev); 2569 addrconf_sit_config(dev);
2540 break; 2570 break;
2541#endif 2571#endif
2572#if defined(CONFIG_NET_IPGRE) || defined(CONFIG_NET_IPGRE_MODULE)
2573 case ARPHRD_IPGRE:
2574 addrconf_gre_config(dev);
2575 break;
2576#endif
2542 case ARPHRD_TUNNEL6: 2577 case ARPHRD_TUNNEL6:
2543 addrconf_ip6_tnl_config(dev); 2578 addrconf_ip6_tnl_config(dev);
2544 break; 2579 break;