]> git.baikalelectronics.ru Git - kernel.git/commit
net: rtnetlink: Enslave device before bringing it up
authorPhil Sutter <phil@nwl.cc>
Wed, 14 Sep 2022 15:06:23 +0000 (17:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 20 Sep 2022 15:37:44 +0000 (08:37 -0700)
commit9c9220a2fcb7da5561cf3f962f56e0a4077614d2
tree6dd3d055ccd7e9529e5fac59b1ee79d6d04856c0
parent14f5b08483dda5ad75c69e6d82a81282430cc742
net: rtnetlink: Enslave device before bringing it up

Unlike with bridges, one can't add an interface to a bond and set it up
at the same time:

| # ip link set dummy0 down
| # ip link set dummy0 master bond0 up
| Error: Device can not be enslaved while up.

Of all drivers with ndo_add_slave callback, bond and team decline if
IFF_UP flag is set, vrf cycles the interface (i.e., sets it down and
immediately up again) and the others just don't care.

Support the common notion of setting the interface up after enslaving it
by sorting the operations accordingly.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220914150623.24152-1-phil@nwl.cc
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/rtnetlink.c