if_faith.c (111119) | if_faith.c (111888) |
---|---|
1/* $KAME: if_faith.c,v 1.23 2001/12/17 13:55:29 sumikawa Exp $ */ 2 3/* 4 * Copyright (c) 1982, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/* $KAME: if_faith.c,v 1.23 2001/12/17 13:55:29 sumikawa Exp $ */ 2 3/* 4 * Copyright (c) 1982, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/net/if_faith.c 111119 2003-02-19 05:47:46Z imp $ | 35 * $FreeBSD: head/sys/net/if_faith.c 111888 2003-03-04 23:19:55Z jlemon $ |
36 */ 37/* 38 * derived from 39 * @(#)if_loop.c 8.1 (Berkeley) 6/10/93 40 * Id: if_loop.c,v 1.22 1996/06/19 16:24:10 wollman Exp 41 */ 42 43/* --- 153 unchanged lines hidden (view full) --- 197int 198faithoutput(ifp, m, dst, rt) 199 struct ifnet *ifp; 200 struct mbuf *m; 201 struct sockaddr *dst; 202 struct rtentry *rt; 203{ 204 int isr; | 36 */ 37/* 38 * derived from 39 * @(#)if_loop.c 8.1 (Berkeley) 6/10/93 40 * Id: if_loop.c,v 1.22 1996/06/19 16:24:10 wollman Exp 41 */ 42 43/* --- 153 unchanged lines hidden (view full) --- 197int 198faithoutput(ifp, m, dst, rt) 199 struct ifnet *ifp; 200 struct mbuf *m; 201 struct sockaddr *dst; 202 struct rtentry *rt; 203{ 204 int isr; |
205 struct ifqueue *ifq = 0; | |
206 207 if ((m->m_flags & M_PKTHDR) == 0) 208 panic("faithoutput no HDR"); 209 210 /* BPF write needs to be handled specially */ 211 if (dst->sa_family == AF_UNSPEC) { 212 dst->sa_family = *(mtod(m, int *)); 213 m->m_len -= sizeof(int); --- 24 unchanged lines hidden (view full) --- 238 return (rt->rt_flags & RTF_BLACKHOLE ? 0 : 239 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); 240 } 241 ifp->if_opackets++; 242 ifp->if_obytes += m->m_pkthdr.len; 243 switch (dst->sa_family) { 244#ifdef INET 245 case AF_INET: | 205 206 if ((m->m_flags & M_PKTHDR) == 0) 207 panic("faithoutput no HDR"); 208 209 /* BPF write needs to be handled specially */ 210 if (dst->sa_family == AF_UNSPEC) { 211 dst->sa_family = *(mtod(m, int *)); 212 m->m_len -= sizeof(int); --- 24 unchanged lines hidden (view full) --- 237 return (rt->rt_flags & RTF_BLACKHOLE ? 0 : 238 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); 239 } 240 ifp->if_opackets++; 241 ifp->if_obytes += m->m_pkthdr.len; 242 switch (dst->sa_family) { 243#ifdef INET 244 case AF_INET: |
246 ifq = &ipintrq; | |
247 isr = NETISR_IP; 248 break; 249#endif 250#ifdef INET6 251 case AF_INET6: | 245 isr = NETISR_IP; 246 break; 247#endif 248#ifdef INET6 249 case AF_INET6: |
252 ifq = &ip6intrq; | |
253 isr = NETISR_IPV6; 254 break; 255#endif 256 default: 257 m_freem(m); 258 return EAFNOSUPPORT; 259 } 260 261 /* XXX do we need more sanity checks? */ 262 263 m->m_pkthdr.rcvif = ifp; 264 ifp->if_ipackets++; 265 ifp->if_ibytes += m->m_pkthdr.len; | 250 isr = NETISR_IPV6; 251 break; 252#endif 253 default: 254 m_freem(m); 255 return EAFNOSUPPORT; 256 } 257 258 /* XXX do we need more sanity checks? */ 259 260 m->m_pkthdr.rcvif = ifp; 261 ifp->if_ipackets++; 262 ifp->if_ibytes += m->m_pkthdr.len; |
266 (void) IF_HANDOFF(ifq, m, NULL); 267 schednetisr(isr); | 263 netisr_dispatch(isr, m); |
268 return (0); 269} 270 271/* ARGSUSED */ 272static void 273faithrtrequest(cmd, rt, info) 274 int cmd; 275 struct rtentry *rt; --- 107 unchanged lines hidden --- | 264 return (0); 265} 266 267/* ARGSUSED */ 268static void 269faithrtrequest(cmd, rt, info) 270 int cmd; 271 struct rtentry *rt; --- 107 unchanged lines hidden --- |