summaryrefslogtreecommitdiffstats
path: root/sys/net/if_lagg.c
diff options
context:
space:
mode:
authorrea <rea@FreeBSD.org>2012-05-28 12:13:04 +0000
committerrea <rea@FreeBSD.org>2012-05-28 12:13:04 +0000
commitcda9e92421edf4b2c7de3bf1ba2d1e87b223e92b (patch)
treec316aa9d46a974bd5ed0e8373344ea658c98df8e /sys/net/if_lagg.c
parent13fb9be43f134d10442d6632c1438aa4916acc8f (diff)
downloadFreeBSD-src-cda9e92421edf4b2c7de3bf1ba2d1e87b223e92b.zip
FreeBSD-src-cda9e92421edf4b2c7de3bf1ba2d1e87b223e92b.tar.gz
if_lagg: allow to invoke SIOCSLAGGPORT multiple times in a row
Currently, 'ifconfig laggX down' does not remove members from this lagg(4) interface. So, 'service netif stop laggX' followed by 'service netif start laggX' will choke, because "stop" will leave interfaces attached to the laggX and ifconfig from the "start" will refuse to add already-existing interfaces. The real-world case is when I am bundling together my Ethernet and WiFi interfaces and using multiple profiles for accessing network in different places: system being booted up with one profile, but later this profile being exchanged to another one, followed by 'service netif restart' will not add WiFi interface back to the lagg: the "stop" action from 'service netif restart' will shut down my main WiFi interface, so wlan0 that exists in the lagg0 will be destroyed and purged from lagg0; the "start" action will try to re-add both interfaces, but since Ethernet one is already in lagg0, ifconfig will refuse to add the wlan0 from WiFi interface. Since adding the interface to the lagg(4) when it is already here should be an idempotent action: we're really not changing anything, so this fix doesn't change the semantics of interface addition. Approved by: thompsa Reviewed by: emaste MFC after: 1 week
Diffstat (limited to 'sys/net/if_lagg.c')
-rw-r--r--sys/net/if_lagg.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index c8b8ecb..9041e18 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -516,8 +516,13 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp)
return (ENOSPC);
/* Check if port has already been associated to a lagg */
- if (ifp->if_lagg != NULL)
+ if (ifp->if_lagg != NULL) {
+ /* Port is already in the current lagg? */
+ lp = (struct lagg_port *)ifp->if_lagg;
+ if (lp->lp_softc == sc)
+ return (EEXIST);
return (EBUSY);
+ }
/* XXX Disallow non-ethernet interfaces (this should be any of 802) */
if (ifp->if_type != IFT_ETHER)
OpenPOWER on IntegriCloud