if_disc.c (121816) | if_disc.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 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93 | 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 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/net/if_disc.c 121816 2003-10-31 18:32:15Z brooks $ | 34 * $FreeBSD: head/sys/net/if_disc.c 123922 2003-12-28 03:56:00Z sam $ |
35 */ 36 37/* 38 * Discard interface driver for protocol testing and timing. 39 * (Based on the loopback.) 40 */ 41 42#include <sys/param.h> --- 116 unchanged lines hidden (view full) --- 159 if (dst->sa_family == AF_UNSPEC) { 160 dst->sa_family = *(mtod(m, int *)); 161 m->m_len -= sizeof(int); 162 m->m_pkthdr.len -= sizeof(int); 163 m->m_data += sizeof(int); 164 } 165 166 if (ifp->if_bpf) { | 35 */ 36 37/* 38 * Discard interface driver for protocol testing and timing. 39 * (Based on the loopback.) 40 */ 41 42#include <sys/param.h> --- 116 unchanged lines hidden (view full) --- 159 if (dst->sa_family == AF_UNSPEC) { 160 dst->sa_family = *(mtod(m, int *)); 161 m->m_len -= sizeof(int); 162 m->m_pkthdr.len -= sizeof(int); 163 m->m_data += sizeof(int); 164 } 165 166 if (ifp->if_bpf) { |
167 /* 168 * We need to prepend the address family as 169 * a four byte field. Cons up a dummy header 170 * to pacify bpf. This is safe because bpf 171 * will only read from the mbuf (i.e., it won't 172 * try to free it or keep a pointer a to it). 173 */ 174 struct mbuf m0; | |
175 u_int af = dst->sa_family; | 167 u_int af = dst->sa_family; |
176 177 m0.m_next = m; 178 m0.m_len = 4; 179 m0.m_data = (char *)⁡ 180 181 BPF_MTAP(ifp, &m0); | 168 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); |
182 } 183 m->m_pkthdr.rcvif = ifp; 184 185 ifp->if_opackets++; 186 ifp->if_obytes += m->m_pkthdr.len; 187 188 m_freem(m); 189 return 0; --- 66 unchanged lines hidden --- | 169 } 170 m->m_pkthdr.rcvif = ifp; 171 172 ifp->if_opackets++; 173 ifp->if_obytes += m->m_pkthdr.len; 174 175 m_freem(m); 176 return 0; --- 66 unchanged lines hidden --- |