From 7b78f731e8c32d3700702dd77110d7982070efc8 Mon Sep 17 00:00:00 2001 From: thompsa Date: Wed, 27 Jun 2012 22:09:04 +0000 Subject: [PATCH] MFC r236178 if_lagg: allow to invoke SIOCSLAGGPORT multiple times in a row git-svn-id: svn://svn.freebsd.org/base/stable/9@237670 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/ifconfig/iflagg.c | 3 ++- sys/net/if_lagg.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index ed39868e1..a47472980 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -40,7 +40,8 @@ setlaggport(const char *val, int d, int s, const struct afswtch *afp) strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname)); strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname)); - if (ioctl(s, SIOCSLAGGPORT, &rp)) + /* Don't choke if the port is already in this lagg. */ + if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST) err(1, "SIOCSLAGGPORT"); } diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 68e21dece..bb6800f1f 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) -- 2.45.0