lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 Nov 2023 16:43:29 -0800
From: Jay Vosburgh <jay.vosburgh@...onical.com>
To: Hangbin Liu <liuhangbin@...il.com>
cc: Eric Dumazet <edumazet@...gle.com>,
    "David S . Miller" <davem@...emloft.net>,
    Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
    Andy Gospodarek <andy@...yhouse.net>, netdev@...r.kernel.org,
    eric.dumazet@...il.com, syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH net] bonding: stop the device in bond_setup_by_slave()

Hangbin Liu <liuhangbin@...il.com> wrote:

>On Fri, Nov 10, 2023 at 11:19:22AM +0200, Jay Vosburgh wrote:
>> >Do we need also do this if the bond changed to ether device from other dev
>> >type? e.g.
>> >
>> >    if (slave_dev->type != ARPHRD_ETHER)
>> >            bond_setup_by_slave(bond_dev, slave_dev);
>> >    else
>> >            bond_ether_setup(bond_dev);
>> 
>> 	I'm not sure I follow your comment; bond_enslave() already has
>> the above logic.  If the bond is not ARPHRD_ETHER and an ARPHRD_ETHER
>> device is added to the bond, the above will take the bond_ether_setup()
>> path, which will call ether_setup() which will set the device to
>> ARPHRD_ETHER.
>> 
>> 	However, my recollection is that the bond device itself should
>> be unregistered if the last interface of a non-ARPHRD_ETHER bond is
>> removed.  This dates back to d90a162a4ee2 ("net/bonding: Destroy bonding
>> master when last slave is gone"), but I don't know if the logic still
>> works correctly (I've not heard much about IPoIB with bonding in a
>> while).  The bond cannot be initially created as non-ARPHRD_ETHER; the
>> type changes when the first such interface is added to the bond.
>
>Ah, thanks for this info. I just tried and it still works. Which looks
>there is no need to close bond dev before bond_ether_setup().
>
>BTW, I tried to set gre0's master to bond0 and change the types. After that,
>`ip link del gre0` will return 0 but gre0 is actually not deleted. I have to
>remove the gre mode to delete the link. Is that expected?

	I don't think that's expected; I'd expect "ip link del" to
delete the interface after removing it from the bond (via the
NETDEV_UNREGISTER case in bond_slave_netdev_event).

	-J

>```
># ip link add bond0 type bond mode 1 miimon 100
># ip link add gre0 type gre
># ip link set gre0 master bond0
># ip link show bond0
>21: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
>    link/gre 0.0.0.0 brd 0.0.0.0
># ip link del gre0
># echo $?
>0
># ip link show gre0
>18: gre0@...E: <NOARP,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UNKNOWN mode DEFAULT group default qlen 1000
>    link/gre 0.0.0.0 brd 0.0.0.0

---
	-Jay Vosburgh, jay.vosburgh@...onical.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ