if_iso88025subr.c (184710) | if_iso88025subr.c (186119) |
---|---|
1/*- 2 * Copyright (c) 1998, Larry Lile 3 * All rights reserved. 4 * 5 * For latest sources and information on this driver, please 6 * go to http://anarchy.stdio.com. 7 * 8 * Questions, comments or suggestions should be directed to --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 1998, Larry Lile 3 * All rights reserved. 4 * 5 * For latest sources and information on this driver, please 6 * go to http://anarchy.stdio.com. 7 * 8 * Questions, comments or suggestions should be directed to --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/net/if_iso88025subr.c 184710 2008-11-06 09:18:29Z bz $ | 33 * $FreeBSD: head/sys/net/if_iso88025subr.c 186119 2008-12-15 06:10:57Z qingli $ |
34 * 35 */ 36 37/* 38 * 39 * General ISO 802.5 (Token Ring) support routines 40 * 41 */ --- 12 unchanged lines hidden (view full) --- 54#include <sys/socket.h> 55#include <sys/sockio.h> 56 57#include <net/if.h> 58#include <net/if_arp.h> 59#include <net/if_dl.h> 60#include <net/if_llc.h> 61#include <net/if_types.h> | 34 * 35 */ 36 37/* 38 * 39 * General ISO 802.5 (Token Ring) support routines 40 * 41 */ --- 12 unchanged lines hidden (view full) --- 54#include <sys/socket.h> 55#include <sys/sockio.h> 56 57#include <net/if.h> 58#include <net/if_arp.h> 59#include <net/if_dl.h> 60#include <net/if_llc.h> 61#include <net/if_types.h> |
62#include <net/if_llatbl.h> |
|
62 63#include <net/ethernet.h> 64#include <net/netisr.h> 65#include <net/route.h> 66#include <net/bpf.h> 67#include <net/iso88025.h> 68 69#if defined(INET) || defined(INET6) --- 168 unchanged lines hidden (view full) --- 238 struct rtentry *rt0; 239{ 240 u_int16_t snap_type = 0; 241 int loop_copy = 0, error = 0, rif_len = 0; 242 u_char edst[ISO88025_ADDR_LEN]; 243 struct iso88025_header *th; 244 struct iso88025_header gen_th; 245 struct sockaddr_dl *sdl = NULL; | 63 64#include <net/ethernet.h> 65#include <net/netisr.h> 66#include <net/route.h> 67#include <net/bpf.h> 68#include <net/iso88025.h> 69 70#if defined(INET) || defined(INET6) --- 168 unchanged lines hidden (view full) --- 239 struct rtentry *rt0; 240{ 241 u_int16_t snap_type = 0; 242 int loop_copy = 0, error = 0, rif_len = 0; 243 u_char edst[ISO88025_ADDR_LEN]; 244 struct iso88025_header *th; 245 struct iso88025_header gen_th; 246 struct sockaddr_dl *sdl = NULL; |
246 struct rtentry *rt = NULL; | 247 struct llentry *lle; |
247 248#ifdef MAC 249 error = mac_ifnet_check_transmit(ifp, m); 250 if (error) 251 senderr(error); 252#endif 253 254 if (ifp->if_flags & IFF_MONITOR) 255 senderr(ENETDOWN); 256 if (!((ifp->if_flags & IFF_UP) && 257 (ifp->if_drv_flags & IFF_DRV_RUNNING))) 258 senderr(ENETDOWN); 259 getmicrotime(&ifp->if_lastchange); 260 261 /* Calculate routing info length based on arp table entry */ 262 /* XXX any better way to do this ? */ | 248 249#ifdef MAC 250 error = mac_ifnet_check_transmit(ifp, m); 251 if (error) 252 senderr(error); 253#endif 254 255 if (ifp->if_flags & IFF_MONITOR) 256 senderr(ENETDOWN); 257 if (!((ifp->if_flags & IFF_UP) && 258 (ifp->if_drv_flags & IFF_DRV_RUNNING))) 259 senderr(ENETDOWN); 260 getmicrotime(&ifp->if_lastchange); 261 262 /* Calculate routing info length based on arp table entry */ 263 /* XXX any better way to do this ? */ |
263 if (rt0 != NULL) { 264 error = rt_check(&rt, &rt0, dst); 265 if (error) 266 goto bad; 267 RT_UNLOCK(rt); 268 } | |
269 | 264 |
270 if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway)) | 265 if (rt0 && (sdl = (struct sockaddr_dl *)rt0->rt_gateway)) |
271 if (SDL_ISO88025(sdl)->trld_rcf != 0) 272 rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf); 273 274 /* Generate a generic 802.5 header for the packet */ 275 gen_th.ac = TR_AC; 276 gen_th.fc = TR_LLC_FRAME; 277 (void)memcpy((caddr_t)gen_th.iso88025_shost, IF_LLADDR(ifp), 278 ISO88025_ADDR_LEN); --- 5 unchanged lines hidden (view full) --- 284 (caddr_t)SDL_ISO88025(sdl)->trld_route, 285 rif_len - 2); 286 } 287 } 288 289 switch (dst->sa_family) { 290#ifdef INET 291 case AF_INET: | 266 if (SDL_ISO88025(sdl)->trld_rcf != 0) 267 rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf); 268 269 /* Generate a generic 802.5 header for the packet */ 270 gen_th.ac = TR_AC; 271 gen_th.fc = TR_LLC_FRAME; 272 (void)memcpy((caddr_t)gen_th.iso88025_shost, IF_LLADDR(ifp), 273 ISO88025_ADDR_LEN); --- 5 unchanged lines hidden (view full) --- 279 (caddr_t)SDL_ISO88025(sdl)->trld_route, 280 rif_len - 2); 281 } 282 } 283 284 switch (dst->sa_family) { 285#ifdef INET 286 case AF_INET: |
292 error = arpresolve(ifp, rt0, m, dst, edst); | 287 error = arpresolve(ifp, rt0, m, dst, edst, &lle); |
293 if (error) 294 return (error == EWOULDBLOCK ? 0 : error); 295 snap_type = ETHERTYPE_IP; 296 break; 297 case AF_ARP: 298 { 299 struct arphdr *ah; 300 ah = mtod(m, struct arphdr *); --- 18 unchanged lines hidden (view full) --- 319 else 320 bcopy(ar_tha(ah), edst, ISO88025_ADDR_LEN); 321 322 } 323 break; 324#endif /* INET */ 325#ifdef INET6 326 case AF_INET6: | 288 if (error) 289 return (error == EWOULDBLOCK ? 0 : error); 290 snap_type = ETHERTYPE_IP; 291 break; 292 case AF_ARP: 293 { 294 struct arphdr *ah; 295 ah = mtod(m, struct arphdr *); --- 18 unchanged lines hidden (view full) --- 314 else 315 bcopy(ar_tha(ah), edst, ISO88025_ADDR_LEN); 316 317 } 318 break; 319#endif /* INET */ 320#ifdef INET6 321 case AF_INET6: |
327 error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst); | 322 error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst, &lle); |
328 if (error) 329 return (error); 330 snap_type = ETHERTYPE_IPV6; 331 break; 332#endif /* INET6 */ 333#ifdef IPX 334 case AF_IPX: 335 { --- 494 unchanged lines hidden --- | 323 if (error) 324 return (error); 325 snap_type = ETHERTYPE_IPV6; 326 break; 327#endif /* INET6 */ 328#ifdef IPX 329 case AF_IPX: 330 { --- 494 unchanged lines hidden --- |