summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/ifconfig/iflagg.c3
-rw-r--r--sys/net/if_lagg.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c
index ed39868..a474729 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 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