if_vlan.c (249932144b7cfcd53cd6bd06e8d05aac5129c890) if_vlan.c (26e30963607e43599915bd7979ceb15fecfc9f33)
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

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

118
119 /* Find the parent. */
120 sc = ifp->if_softc;
121 ifp_p = sc->ifv_p;
122
123 bzero((char *)&sdl, sizeof sdl);
124 sdl.sdl_len = sizeof sdl;
125 sdl.sdl_family = AF_LINK;
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

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

118
119 /* Find the parent. */
120 sc = ifp->if_softc;
121 ifp_p = sc->ifv_p;
122
123 bzero((char *)&sdl, sizeof sdl);
124 sdl.sdl_len = sizeof sdl;
125 sdl.sdl_family = AF_LINK;
126 sdl.sdl_index = ifp_p->if_index;
127 sdl.sdl_type = IFT_ETHER;
126 sdl.sdl_alen = ETHER_ADDR_LEN;
127
128 /* First, remove any existing filter entries. */
129 while(SLIST_FIRST(&sc->vlan_mc_listhead) != NULL) {
130 mc = SLIST_FIRST(&sc->vlan_mc_listhead);
131 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
132 error = if_delmulti(ifp_p, (struct sockaddr *)&sdl);
133 if (error)

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

139 /* Now program new ones. */
140 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
141 if (ifma->ifma_addr->sa_family != AF_LINK)
142 continue;
143 mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_WAITOK);
144 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
145 (char *)&mc->mc_addr, ETHER_ADDR_LEN);
146 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
128 sdl.sdl_alen = ETHER_ADDR_LEN;
129
130 /* First, remove any existing filter entries. */
131 while(SLIST_FIRST(&sc->vlan_mc_listhead) != NULL) {
132 mc = SLIST_FIRST(&sc->vlan_mc_listhead);
133 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
134 error = if_delmulti(ifp_p, (struct sockaddr *)&sdl);
135 if (error)

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

141 /* Now program new ones. */
142 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
143 if (ifma->ifma_addr->sa_family != AF_LINK)
144 continue;
145 mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_WAITOK);
146 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
147 (char *)&mc->mc_addr, ETHER_ADDR_LEN);
148 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
149 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
150 LLADDR(&sdl), ETHER_ADDR_LEN);
147 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
148 if (error)
149 return(error);
150 }
151
152 return(0);
153}
154

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

172 ifp->if_start = vlan_start;
173 ifp->if_ioctl = vlan_ioctl;
174 ifp->if_output = ether_output;
175 ifp->if_snd.ifq_maxlen = ifqmaxlen;
176 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
177 /* Now undo some of the damage... */
178 ifp->if_data.ifi_type = IFT_8021_VLAN;
179 ifp->if_data.ifi_hdrlen = EVL_ENCAPLEN;
151 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
152 if (error)
153 return(error);
154 }
155
156 return(0);
157}
158

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

176 ifp->if_start = vlan_start;
177 ifp->if_ioctl = vlan_ioctl;
178 ifp->if_output = ether_output;
179 ifp->if_snd.ifq_maxlen = ifqmaxlen;
180 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
181 /* Now undo some of the damage... */
182 ifp->if_data.ifi_type = IFT_8021_VLAN;
183 ifp->if_data.ifi_hdrlen = EVL_ENCAPLEN;
180 ifp->if_resolvemulti = 0;
181 }
182}
183
184static int
185vlan_modevent(module_t mod, int type, void *data)
186{
187 switch (type) {
188 case MOD_LOAD:

--- 381 unchanged lines hidden ---
184 }
185}
186
187static int
188vlan_modevent(module_t mod, int type, void *data)
189{
190 switch (type) {
191 case MOD_LOAD:

--- 381 unchanged lines hidden ---