diff options
author | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2005-10-23 14:07:12 +0000 |
---|---|---|
committer | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2005-10-23 14:07:12 +0000 |
commit | 8cfa69fc18d7646a6ddce7e62fded41441aab367 (patch) | |
tree | c1b8f014fcfe6ad6ddc0a2ef105e5820a5266181 /sys/net/if_trunk.c | |
parent | 6404af5bce72dc2221ebb9a740f9f9bd06e65762 (diff) |
Rework of multicast deletion code for vlan(4) and trunk(4).
The previous code could wrongly delete multicast groups
on the parent interface. Now we forward only remembered
delete requests.
OK mcbride, mickey.
Diffstat (limited to 'sys/net/if_trunk.c')
-rw-r--r-- | sys/net/if_trunk.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 79b9b6c568c..5e84069799c 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.9 2005/10/09 18:45:27 reyk Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.10 2005/10/23 14:07:11 mpf Exp $ */ /* * Copyright (c) 2005 Reyk Floeter <reyk@vantronix.net> @@ -757,6 +757,16 @@ trunk_ether_delmulti(struct trunk_softc *tr, struct ifreq *ifr) if ((error = ether_multiaddr(&ifr->ifr_addr, addrlo, addrhi)) != 0) return (error); ETHER_LOOKUP_MULTI(addrlo, addrhi, &tr->tr_ac, enm); + if (enm == NULL) + return (EINVAL); + + SLIST_FOREACH(mc, &tr->tr_mc_head, mc_entries) + if (mc->mc_enm == enm) + break; + + /* We won't delete entries we didn't add */ + if (mc == NULL) + return (EINVAL); if ((error = ether_delmulti(ifr, &tr->tr_ac)) != ENETRESET) return (error); @@ -770,13 +780,8 @@ trunk_ether_delmulti(struct trunk_softc *tr, struct ifreq *ifr) } } - SLIST_FOREACH(mc, &tr->tr_mc_head, mc_entries) { - if (mc->mc_enm == enm) { - SLIST_REMOVE(&tr->tr_mc_head, mc, trunk_mc, mc_entries); - free(mc, M_DEVBUF); - break; - } - } + SLIST_REMOVE(&tr->tr_mc_head, mc, trunk_mc, mc_entries); + free(mc, M_DEVBUF); return (0); } |