Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: Simplify link-local address generation for IPv6 GRE.

Since commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
generation."), addrconf_gre_config() has stopped handling IP6GRE
devices specially and just calls the regular addrconf_addr_gen()
function to create their link-local IPv6 addresses.

We can thus avoid using addrconf_gre_config() for IP6GRE devices and
use the normal IPv6 initialisation path instead (that is, jump directly
to addrconf_dev_config() in addrconf_init_auto_addrs()).

See commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
generation.") for a deeper explanation on how and why GRE devices
started handling their IPv6 link-local address generation specially,
why it was a problem, and why this is not even necessary in most cases
(especially for GRE over IPv6).

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/a9144be9c7ec3cf09f25becae5e8fdf141fde9f6.1750075076.git.gnault@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Guillaume Nault and committed by
Paolo Abeni
d3623dd5 f6be1f29

+5 -5
+5 -5
net/ipv6/addrconf.c
··· 3208 3208 } 3209 3209 } 3210 3210 3211 - #if IS_ENABLED(CONFIG_IPV6_SIT) || IS_ENABLED(CONFIG_NET_IPGRE) || IS_ENABLED(CONFIG_IPV6_GRE) 3211 + #if IS_ENABLED(CONFIG_IPV6_SIT) || IS_ENABLED(CONFIG_NET_IPGRE) 3212 3212 static void add_v4_addrs(struct inet6_dev *idev) 3213 3213 { 3214 3214 struct in6_addr addr; ··· 3463 3463 (dev->type != ARPHRD_IEEE1394) && 3464 3464 (dev->type != ARPHRD_TUNNEL6) && 3465 3465 (dev->type != ARPHRD_6LOWPAN) && 3466 + (dev->type != ARPHRD_IP6GRE) && 3466 3467 (dev->type != ARPHRD_TUNNEL) && 3467 3468 (dev->type != ARPHRD_NONE) && 3468 3469 (dev->type != ARPHRD_RAWIP)) { ··· 3519 3518 } 3520 3519 #endif 3521 3520 3522 - #if IS_ENABLED(CONFIG_NET_IPGRE) || IS_ENABLED(CONFIG_IPV6_GRE) 3521 + #if IS_ENABLED(CONFIG_NET_IPGRE) 3523 3522 static void addrconf_gre_config(struct net_device *dev) 3524 3523 { 3525 3524 struct inet6_dev *idev; ··· 3537 3536 * which is in EUI64 mode (as __ipv6_isatap_ifid() would fail in this 3538 3537 * case). Such devices fall back to add_v4_addrs() instead. 3539 3538 */ 3540 - if (!(dev->type == ARPHRD_IPGRE && *(__be32 *)dev->dev_addr == 0 && 3539 + if (!(*(__be32 *)dev->dev_addr == 0 && 3541 3540 idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64)) { 3542 3541 addrconf_addr_gen(idev, true); 3543 3542 return; ··· 3558 3557 addrconf_sit_config(dev); 3559 3558 break; 3560 3559 #endif 3561 - #if IS_ENABLED(CONFIG_NET_IPGRE) || IS_ENABLED(CONFIG_IPV6_GRE) 3562 - case ARPHRD_IP6GRE: 3560 + #if IS_ENABLED(CONFIG_NET_IPGRE) 3563 3561 case ARPHRD_IPGRE: 3564 3562 addrconf_gre_config(dev); 3565 3563 break;