Skip to contentSkip to conversation

bridge: remove !IFF_UP restriction when deleting bridge from ioctl

RFC PATCH In review Dan Williams 3 participants 4 messages Apr 4, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 54d207d..33cd83f 100644
@@ -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;
-	}
-
 	else
 		br_dev_delete(dev, NULL);
 
 	rtnl_unlock();
 	return ret;
 }
 
maintainer
#1 lore raw

From: Dan Williams <[email protected]>
Date: Fri, 04 Apr 2014 09:56:22 -0500

Quoted 11 lines

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.

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.

#2 lore raw
Quoted 8 lines · David Miller

From: Dan Williams <[email protected]>
Date: Fri, 04 Apr 2014 09:56:22 -0500

Quoted 5 lines

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.

Quoted 8 lines
Quoted 6 lines

---
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.

Unfortunately I think we're stuck with the existing behavior.

Ok, fair enough.

Dan

#3 lore raw
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 -0500

Quoted 11 lines

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.

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.