Deleted Added
full compact
if_lagg.c (267992) if_lagg.c (269492)
1/* $OpenBSD: if_trunk.c,v 1.30 2007/01/31 06:20:19 reyk Exp $ */
2
3/*
4 * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
5 * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
1/* $OpenBSD: if_trunk.c,v 1.30 2007/01/31 06:20:19 reyk Exp $ */
2
3/*
4 * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
5 * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
21__FBSDID("$FreeBSD: head/sys/net/if_lagg.c 267992 2014-06-28 03:56:17Z hselasky $");
21__FBSDID("$FreeBSD: head/sys/net/if_lagg.c 269492 2014-08-04 00:58:12Z mav $");
22
23#include "opt_inet.h"
24#include "opt_inet6.h"
25
26#include <sys/param.h>
27#include <sys/kernel.h>
28#include <sys/malloc.h>
29#include <sys/mbuf.h>

--- 1182 unchanged lines hidden (view full) ---

1212
1213static int
1214lagg_ether_cmdmulti(struct lagg_port *lp, int set)
1215{
1216 struct lagg_softc *sc = lp->lp_softc;
1217 struct ifnet *ifp = lp->lp_ifp;
1218 struct ifnet *scifp = sc->sc_ifp;
1219 struct lagg_mc *mc;
22
23#include "opt_inet.h"
24#include "opt_inet6.h"
25
26#include <sys/param.h>
27#include <sys/kernel.h>
28#include <sys/malloc.h>
29#include <sys/mbuf.h>

--- 1182 unchanged lines hidden (view full) ---

1212
1213static int
1214lagg_ether_cmdmulti(struct lagg_port *lp, int set)
1215{
1216 struct lagg_softc *sc = lp->lp_softc;
1217 struct ifnet *ifp = lp->lp_ifp;
1218 struct ifnet *scifp = sc->sc_ifp;
1219 struct lagg_mc *mc;
1220 struct ifmultiaddr *ifma, *rifma = NULL;
1221 struct sockaddr_dl sdl;
1220 struct ifmultiaddr *ifma;
1222 int error;
1223
1224 LAGG_WLOCK_ASSERT(sc);
1225
1221 int error;
1222
1223 LAGG_WLOCK_ASSERT(sc);
1224
1226 link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER);
1227 sdl.sdl_alen = ETHER_ADDR_LEN;
1228
1229 if (set) {
1225 if (set) {
1226 IF_ADDR_WLOCK(scifp);
1230 TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) {
1231 if (ifma->ifma_addr->sa_family != AF_LINK)
1232 continue;
1227 TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) {
1228 if (ifma->ifma_addr->sa_family != AF_LINK)
1229 continue;
1233 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
1234 LLADDR(&sdl), ETHER_ADDR_LEN);
1235
1236 error = if_addmulti(ifp, (struct sockaddr *)&sdl, &rifma);
1237 if (error)
1238 return (error);
1239 mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT);
1230 mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT);
1240 if (mc == NULL)
1231 if (mc == NULL) {
1232 IF_ADDR_WUNLOCK(scifp);
1241 return (ENOMEM);
1233 return (ENOMEM);
1242 mc->mc_ifma = rifma;
1234 }
1235 bcopy(ifma->ifma_addr, &mc->mc_addr,
1236 ifma->ifma_addr->sa_len);
1237 mc->mc_addr.sdl_index = ifp->if_index;
1238 mc->mc_ifma = NULL;
1243 SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries);
1244 }
1239 SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries);
1240 }
1241 IF_ADDR_WUNLOCK(scifp);
1242 SLIST_FOREACH (mc, &lp->lp_mc_head, mc_entries) {
1243 error = if_addmulti(ifp,
1244 (struct sockaddr *)&mc->mc_addr, &mc->mc_ifma);
1245 if (error)
1246 return (error);
1247 }
1245 } else {
1246 while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) {
1247 SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries);
1248 } else {
1249 while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) {
1250 SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries);
1248 if_delmulti_ifma(mc->mc_ifma);
1251 if (mc->mc_ifma && !lp->lp_detaching)
1252 if_delmulti_ifma(mc->mc_ifma);
1249 free(mc, M_DEVBUF);
1250 }
1251 }
1252 return (0);
1253}
1254
1255/* Handle a ref counted flag that should be set on the lagg port as well */
1256static int

--- 762 unchanged lines hidden ---
1253 free(mc, M_DEVBUF);
1254 }
1255 }
1256 return (0);
1257}
1258
1259/* Handle a ref counted flag that should be set on the lagg port as well */
1260static int

--- 762 unchanged lines hidden ---