if_stf.c (147346) | if_stf.c (147611) |
---|---|
1/* $FreeBSD: head/sys/net/if_stf.c 147346 2005-06-13 17:17:07Z brooks $ */ | 1/* $FreeBSD: head/sys/net/if_stf.c 147611 2005-06-26 18:11:11Z dwmalone $ */ |
2/* $KAME: if_stf.c,v 1.73 2001/12/03 11:08:30 keiichi Exp $ */ 3 4/*- 5 * Copyright (C) 2000 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 230 unchanged lines hidden (view full) --- 240 return (ENOMEM); 241 } 242 243 ifp->if_mtu = IPV6_MMTU; 244 ifp->if_ioctl = stf_ioctl; 245 ifp->if_output = stf_output; 246 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 247 if_attach(ifp); | 2/* $KAME: if_stf.c,v 1.73 2001/12/03 11:08:30 keiichi Exp $ */ 3 4/*- 5 * Copyright (C) 2000 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 230 unchanged lines hidden (view full) --- 240 return (ENOMEM); 241 } 242 243 ifp->if_mtu = IPV6_MMTU; 244 ifp->if_ioctl = stf_ioctl; 245 ifp->if_output = stf_output; 246 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 247 if_attach(ifp); |
248 bpfattach(ifp, DLT_NULL, sizeof(u_int)); | 248 bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); |
249 mtx_lock(&stf_mtx); 250 LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list); 251 mtx_unlock(&stf_mtx); 252 return (0); 253} 254 255static void 256stf_destroy(struct stf_softc *sc) --- 176 unchanged lines hidden (view full) --- 433 struct sockaddr_in6 *dst6; 434 struct in_addr in4; 435 caddr_t ptr; 436 struct sockaddr_in *dst4; 437 u_int8_t tos; 438 struct ip *ip; 439 struct ip6_hdr *ip6; 440 struct in6_ifaddr *ia6; | 249 mtx_lock(&stf_mtx); 250 LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list); 251 mtx_unlock(&stf_mtx); 252 return (0); 253} 254 255static void 256stf_destroy(struct stf_softc *sc) --- 176 unchanged lines hidden (view full) --- 433 struct sockaddr_in6 *dst6; 434 struct in_addr in4; 435 caddr_t ptr; 436 struct sockaddr_in *dst4; 437 u_int8_t tos; 438 struct ip *ip; 439 struct ip6_hdr *ip6; 440 struct in6_ifaddr *ia6; |
441 u_int32_t af; |
|
441#ifdef MAC 442 int error; 443 444 error = mac_check_ifnet_transmit(ifp, m); 445 if (error) { 446 m_freem(m); 447 return (error); 448 } --- 27 unchanged lines hidden (view full) --- 476 ifp->if_oerrors++; 477 return ENOBUFS; 478 } 479 } 480 ip6 = mtod(m, struct ip6_hdr *); 481 tos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; 482 483 /* | 442#ifdef MAC 443 int error; 444 445 error = mac_check_ifnet_transmit(ifp, m); 446 if (error) { 447 m_freem(m); 448 return (error); 449 } --- 27 unchanged lines hidden (view full) --- 477 ifp->if_oerrors++; 478 return ENOBUFS; 479 } 480 } 481 ip6 = mtod(m, struct ip6_hdr *); 482 tos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; 483 484 /* |
485 * BPF writes need to be handled specially. 486 * This is a null operation, nothing here checks dst->sa_family. 487 */ 488 if (dst->sa_family == AF_UNSPEC) { 489 bcopy(dst->sa_data, &af, sizeof(af)); 490 dst->sa_family = af; 491 } 492 493 /* |
|
484 * Pickup the right outer dst addr from the list of candidates. 485 * ip6_dst has priority as it may be able to give us shorter IPv4 hops. 486 */ 487 ptr = NULL; 488 if (IN6_IS_ADDR_6TO4(&ip6->ip6_dst)) 489 ptr = GET_V4(&ip6->ip6_dst); 490 else if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr)) 491 ptr = GET_V4(&dst6->sin6_addr); --- 7 unchanged lines hidden (view full) --- 499 if (ifp->if_bpf) { 500 /* 501 * We need to prepend the address family as 502 * a four byte field. Cons up a dummy header 503 * to pacify bpf. This is safe because bpf 504 * will only read from the mbuf (i.e., it won't 505 * try to free it or keep a pointer a to it). 506 */ | 494 * Pickup the right outer dst addr from the list of candidates. 495 * ip6_dst has priority as it may be able to give us shorter IPv4 hops. 496 */ 497 ptr = NULL; 498 if (IN6_IS_ADDR_6TO4(&ip6->ip6_dst)) 499 ptr = GET_V4(&ip6->ip6_dst); 500 else if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr)) 501 ptr = GET_V4(&dst6->sin6_addr); --- 7 unchanged lines hidden (view full) --- 509 if (ifp->if_bpf) { 510 /* 511 * We need to prepend the address family as 512 * a four byte field. Cons up a dummy header 513 * to pacify bpf. This is safe because bpf 514 * will only read from the mbuf (i.e., it won't 515 * try to free it or keep a pointer a to it). 516 */ |
507 u_int32_t af = AF_INET6; | 517 af = AF_INET6; |
508 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); 509 } 510 511 M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); 512 if (m && m->m_len < sizeof(struct ip)) 513 m = m_pullup(m, sizeof(struct ip)); 514 if (m == NULL) { 515 ifp->if_oerrors++; --- 315 unchanged lines hidden --- | 518 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); 519 } 520 521 M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); 522 if (m && m->m_len < sizeof(struct ip)) 523 m = m_pullup(m, sizeof(struct ip)); 524 if (m == NULL) { 525 ifp->if_oerrors++; --- 315 unchanged lines hidden --- |