Deleted Added
full compact
if_vlan.c (71862) if_vlan.c (71959)
1/*
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/net/if_vlan.c 71862 2001-01-31 07:58:58Z peter $
29 * $FreeBSD: head/sys/net/if_vlan.c 71959 2001-02-03 11:46:35Z phk $
30 */
31
32/*
33 * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs.
34 * Might be extended some day to also handle IEEE 802.1p priority
35 * tagging. This is sort of sneaky in the implementation, since
36 * we need to pretend to be enough of an Ethernet implementation
37 * to make arp work. The way we do this is by telling everyone

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

119 /* Find the parent. */
120 sc = ifp->if_softc;
121 ifp_p = sc->ifv_p;
122
123 sdl.sdl_len = ETHER_ADDR_LEN;
124 sdl.sdl_family = AF_LINK;
125
126 /* First, remove any existing filter entries. */
30 */
31
32/*
33 * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs.
34 * Might be extended some day to also handle IEEE 802.1p priority
35 * tagging. This is sort of sneaky in the implementation, since
36 * we need to pretend to be enough of an Ethernet implementation
37 * to make arp work. The way we do this is by telling everyone

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

119 /* Find the parent. */
120 sc = ifp->if_softc;
121 ifp_p = sc->ifv_p;
122
123 sdl.sdl_len = ETHER_ADDR_LEN;
124 sdl.sdl_family = AF_LINK;
125
126 /* First, remove any existing filter entries. */
127 while(sc->vlan_mc_listhead.slh_first != NULL) {
128 mc = sc->vlan_mc_listhead.slh_first;
127 while(SLIST_FIRST(&sc->vlan_mc_listhead) != NULL) {
128 mc = SLIST_FIRST(&sc->vlan_mc_listhead);
129 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
130 error = if_delmulti(ifp_p, (struct sockaddr *)&sdl);
131 if (error)
132 return(error);
133 SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries);
134 free(mc, M_DEVBUF);
135 }
136
137 /* Now program new ones. */
129 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
130 error = if_delmulti(ifp_p, (struct sockaddr *)&sdl);
131 if (error)
132 return(error);
133 SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries);
134 free(mc, M_DEVBUF);
135 }
136
137 /* Now program new ones. */
138 for (ifma = ifp->if_multiaddrs.lh_first;
139 ifma != NULL;ifma = ifma->ifma_link.le_next) {
138 for (ifma = LIST_FIRST(&ifp->if_multiaddrs);
139 ifma != NULL;ifma = LIST_NEXT(ifma, ifma_link)) {
140 if (ifma->ifma_addr->sa_family != AF_LINK)
141 continue;
142 mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT);
143 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
144 (char *)&mc->mc_addr, ETHER_ADDR_LEN);
145 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
146 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
147 if (error)

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

410 p = ifv->ifv_p;
411
412 /*
413 * Since the interface is being unconfigured, we need to
414 * empty the list of multicast groups that we may have joined
415 * while we were alive and remove them from the parent's list
416 * as well.
417 */
140 if (ifma->ifma_addr->sa_family != AF_LINK)
141 continue;
142 mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT);
143 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
144 (char *)&mc->mc_addr, ETHER_ADDR_LEN);
145 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
146 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
147 if (error)

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

410 p = ifv->ifv_p;
411
412 /*
413 * Since the interface is being unconfigured, we need to
414 * empty the list of multicast groups that we may have joined
415 * while we were alive and remove them from the parent's list
416 * as well.
417 */
418 while(ifv->vlan_mc_listhead.slh_first != NULL) {
418 while(SLIST_FIRST(&ifv->vlan_mc_listhead) != NULL) {
419 struct sockaddr_dl sdl;
420
421 sdl.sdl_len = ETHER_ADDR_LEN;
422 sdl.sdl_family = AF_LINK;
419 struct sockaddr_dl sdl;
420
421 sdl.sdl_len = ETHER_ADDR_LEN;
422 sdl.sdl_family = AF_LINK;
423 mc = ifv->vlan_mc_listhead.slh_first;
423 mc = SLIST_FIRST(&ifv->vlan_mc_listhead);
424 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
425 error = if_delmulti(p, (struct sockaddr *)&sdl);
426 error = if_delmulti(ifp, (struct sockaddr *)&sdl);
427 if (error)
428 return(error);
429 SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries);
430 free(mc, M_DEVBUF);
431 }

--- 120 unchanged lines hidden ---
424 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
425 error = if_delmulti(p, (struct sockaddr *)&sdl);
426 error = if_delmulti(ifp, (struct sockaddr *)&sdl);
427 if (error)
428 return(error);
429 SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries);
430 free(mc, M_DEVBUF);
431 }

--- 120 unchanged lines hidden ---