if_loop.c (122922) | if_loop.c (123922) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 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 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95 | 1/* 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 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 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95 |
34 * $FreeBSD: head/sys/net/if_loop.c 122922 2003-11-20 20:07:39Z andre $ | 34 * $FreeBSD: head/sys/net/if_loop.c 123922 2003-12-28 03:56:00Z sam $ |
35 */ 36 37/* 38 * Loopback interface driver for protocol testing and timing. 39 */ 40 41#include "opt_atalk.h" 42#include "opt_inet.h" --- 204 unchanged lines hidden (view full) --- 247 af = *(mtod(m, int *)); 248 m->m_len -= sizeof(int); 249 m->m_pkthdr.len -= sizeof(int); 250 m->m_data += sizeof(int); 251 } 252 253 /* Let BPF see incoming packet */ 254 if (ifp->if_bpf) { | 35 */ 36 37/* 38 * Loopback interface driver for protocol testing and timing. 39 */ 40 41#include "opt_atalk.h" 42#include "opt_inet.h" --- 204 unchanged lines hidden (view full) --- 247 af = *(mtod(m, int *)); 248 m->m_len -= sizeof(int); 249 m->m_pkthdr.len -= sizeof(int); 250 m->m_data += sizeof(int); 251 } 252 253 /* Let BPF see incoming packet */ 254 if (ifp->if_bpf) { |
255 struct mbuf m0, *n = m; 256 | |
257 if (ifp->if_bpf->bif_dlt == DLT_NULL) { | 255 if (ifp->if_bpf->bif_dlt == DLT_NULL) { |
256 u_int32_t af1 = af; /* XXX beware sizeof(af) != 4 */ |
|
258 /* | 257 /* |
259 * We need to prepend the address family as 260 * a four byte field. Cons up a dummy header 261 * to pacify bpf. This is safe because bpf 262 * will only read from the mbuf (i.e., it won't 263 * try to free it or keep a pointer a to it). | 258 * We need to prepend the address family. |
264 */ | 259 */ |
265 m0.m_next = m; 266 m0.m_len = 4; 267 m0.m_data = (char *)⁡ 268 n = &m0; 269 } 270 BPF_MTAP(ifp, n); | 260 bpf_mtap2(ifp->if_bpf, &af1, sizeof(af1), m); 261 } else 262 bpf_mtap(ifp->if_bpf, m); |
271 } 272 273 /* Strip away media header */ 274 if (hlen > 0) { 275 m_adj(m, hlen); 276#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) 277 /* The alpha doesn't like unaligned data. 278 * We move data down in the first mbuf */ --- 117 unchanged lines hidden --- | 263 } 264 265 /* Strip away media header */ 266 if (hlen > 0) { 267 m_adj(m, hlen); 268#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) 269 /* The alpha doesn't like unaligned data. 270 * We move data down in the first mbuf */ --- 117 unchanged lines hidden --- |