Re: [PATCH net v2] ipv6: don't auto-add link-local address to lag ports

From: David Miller
Date: Wed Apr 01 2020 - 14:14:30 EST


From: Jarod Wilson <jarod@xxxxxxxxxx>
Date: Mon, 30 Mar 2020 11:22:19 -0400

> Bonding slave and team port devices should not have link-local addresses
> automatically added to them, as it can interfere with openvswitch being
> able to properly add tc ingress.
>
> Basic reproducer, courtesy of Marcelo:
...
> (above trimmed to relevant entries, obviously)
>
> $ sysctl net.ipv6.conf.ens2f0np0.addr_gen_mode=0
> net.ipv6.conf.ens2f0np0.addr_gen_mode = 0
> $ sysctl net.ipv6.conf.ens2f1np2.addr_gen_mode=0
> net.ipv6.conf.ens2f1np2.addr_gen_mode = 0
>
> $ ip a l ens2f0np0
> 2: ens2f0np0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc
> mq master bond0 state UP group default qlen 1000
> link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff
> inet6 fe80::20f:53ff:fe2f:ea40/64 scope link tentative
> valid_lft forever preferred_lft forever
> $ ip a l ens2f1np2
> 5: ens2f1np2: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc
> mq master bond0 state DOWN group default qlen 1000
> link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff
> inet6 fe80::20f:53ff:fe2f:ea40/64 scope link tentative
> valid_lft forever preferred_lft forever
>
> Looks like addrconf_sysctl_addr_gen_mode() bypasses the original "is
> this a slave interface?" check added by commit c2edacf80e15, and
> results in an address getting added, while w/the proposed patch added,
> no address gets added. This simply adds the same gating check to another
> code path, and thus should prevent the same devices from erroneously
> obtaining an ipv6 link-local address.
>
> Fixes: d35a00b8e33d ("net/ipv6: allow sysctl to change link-local address generation mode")
> Reported-by: Moshe Levi <moshele@xxxxxxxxxxxx>
> CC: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
> CC: Marcelo Ricardo Leitner <mleitner@xxxxxxxxxx>
> CC: netdev@xxxxxxxxxxxxxxx
> Signed-off-by: Jarod Wilson <jarod@xxxxxxxxxx>

Applied and queued up for -stable, thanks.