Deleted Added
sdiff udiff text old ( 267992 ) new ( 269492 )
full compact
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 $");
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;
1222 int error;
1223
1224 LAGG_WLOCK_ASSERT(sc);
1225
1226 link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER);
1227 sdl.sdl_alen = ETHER_ADDR_LEN;
1228
1229 if (set) {
1230 TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) {
1231 if (ifma->ifma_addr->sa_family != AF_LINK)
1232 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);
1240 if (mc == NULL)
1241 return (ENOMEM);
1242 mc->mc_ifma = rifma;
1243 SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries);
1244 }
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 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 ---