bridge: remove !IFF_UP restriction when deleting bridge from ioctl
Subsystems (3)
RFC PATCH 1/1 bridge: remove !IFF_UP restriction when deleting bridge from ioctl
netlink doesn't care about IFF_UP when deleting a bridge, so "ip link del br0" works just fine. The ioctl does care, which means that brctl complains "bridge br0 still up; can't delete it". Make things consistent by always allowing bridge deletion even if the bridge is up.
---
Question: does anyone consider the ioctl behavior API? Can we change it even though it's been this way forever? It means that bridges that previously would not have been deleted by brctl will now be deleted. But anyone using /sbin/ip could already delete them.
net/bridge/br_if.c +0 -5
@@ -264,19 +264,14 @@ int br_del_bridge(struct net *net, const char *name) ret = -ENXIO ;/* Could not find device */ else if (!(dev->priv_flags & IFF_EBRIDGE)) {/* Attempt to delete non bridge device! */ ret = -EPERM ; } - else if (dev->flags & IFF_UP) { -/* Not shutdown yet. */ - ret = -EBUSY ; - } - elsebr_dev_delete (dev ,NULL );rtnl_unlock ();return ret; }
David Miller
maintainerFrom: Dan Williams <[email protected]>
Date: Fri, 04 Apr 2014 09:56:22 -0500
Quoted 11 lines
netlink doesn't care about
IFF_UPwhen deleting a bridge, so "ip link del br0" works just fine. The ioctl does care, which means that brctl complains "bridge br0 still up; can't delete it". Make things consistent by always allowing bridge deletion even if the bridge is up.Signed-off-by Dan Williams <[email protected]>---
Question: does anyone consider the ioctl behavior API? Can we change it even though it's been this way forever? It means that bridges that previously would not have been deleted by brctl will now be deleted. But anyone using/sbin/ipcould already delete them.
Unfortunately I think we're stuck with the existing behavior.
And since, as you say, iproute2 always does the removal when the device is up, the behavior you desire is available.
Quoted 8 lines · David Miller
From: Dan Williams <[email protected]>
Date: Fri, 04 Apr 2014 09:56:22 -0500Quoted 5 lines
netlink doesn't care about
IFF_UPwhen deleting a bridge, so "ip link del br0" works just fine. The ioctl does care, which means that brctl complains "bridge br0 still up; can't delete it". Make things consistent by always allowing bridge deletion even if the bridge is up.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Dan Williams <[email protected]>---
Question: does anyone consider the ioctl behavior API? Can we change it even though it's been this way forever? It means that bridges that previously would not have been deleted by brctl will now be deleted. But anyone using/sbin/ipcould already delete them.Unfortunately I think we're stuck with the existing behavior.
Ok, fair enough.
Dan
Quoted 16 lines · On Fri, 04 Apr 2014 10:15:50 -0500 Dan Williams <[email protected]> wrote:
Quoted 15 lines · David Miller
From: Dan Williams <[email protected]>
Date: Fri, 04 Apr 2014 09:56:22 -0500Quoted 11 lines
netlink doesn't care about
IFF_UPwhen deleting a bridge, so "ip link del br0" works just fine. The ioctl does care, which means that brctl complains "bridge br0 still up; can't delete it". Make things consistent by always allowing bridge deletion even if the bridge is up.Signed-off-by Dan Williams <[email protected]>---
Question: does anyone consider the ioctl behavior API? Can we change it even though it's been this way forever? It means that bridges that previously would not have been deleted by brctl will now be deleted. But anyone using/sbin/ipcould already delete them.
Quoted 7 lines
Quoted 1 line
Unfortunately I think we're stuck with the existing behavior.
Ok, fair enough.
Dan
That is the way it has been all the way back to 2.4.