Deleted Added
full compact
if_loop.c (65454) if_loop.c (69152)
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.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 * @(#)if_loop.c 8.1 (Berkeley) 6/10/93
34 * $FreeBSD: head/sys/net/if_loop.c 65454 2000-09-04 21:46:27Z rwatson $
34 * $FreeBSD: head/sys/net/if_loop.c 69152 2000-11-25 07:35:38Z jlemon $
35 */
36
37/*
38 * Loopback interface driver for protocol testing and timing.
39 */
40#include "loop.h"
41
42#include "opt_atalk.h"

--- 159 unchanged lines hidden (view full) ---

202
203int
204if_simloop(ifp, m, af, hlen)
205 struct ifnet *ifp;
206 register struct mbuf *m;
207 int af;
208 int hlen;
209{
35 */
36
37/*
38 * Loopback interface driver for protocol testing and timing.
39 */
40#include "loop.h"
41
42#include "opt_atalk.h"

--- 159 unchanged lines hidden (view full) ---

202
203int
204if_simloop(ifp, m, af, hlen)
205 struct ifnet *ifp;
206 register struct mbuf *m;
207 int af;
208 int hlen;
209{
210 int s, isr;
211 register struct ifqueue *ifq = 0;
210 int isr;
211 struct ifqueue *inq = 0;
212
213 KASSERT((m->m_flags & M_PKTHDR) != 0, ("if_simloop: no HDR"));
214 m->m_pkthdr.rcvif = ifp;
215
216 /* BPF write needs to be handled specially */
217 if (af == AF_UNSPEC) {
218 KASSERT(m->m_len >= sizeof(int), ("if_simloop: m_len"));
219 af = *(mtod(m, int *));

--- 36 unchanged lines hidden (view full) ---

256 }
257#endif
258 }
259
260 /* Deliver to upper layer protocol */
261 switch (af) {
262#ifdef INET
263 case AF_INET:
212
213 KASSERT((m->m_flags & M_PKTHDR) != 0, ("if_simloop: no HDR"));
214 m->m_pkthdr.rcvif = ifp;
215
216 /* BPF write needs to be handled specially */
217 if (af == AF_UNSPEC) {
218 KASSERT(m->m_len >= sizeof(int), ("if_simloop: m_len"));
219 af = *(mtod(m, int *));

--- 36 unchanged lines hidden (view full) ---

256 }
257#endif
258 }
259
260 /* Deliver to upper layer protocol */
261 switch (af) {
262#ifdef INET
263 case AF_INET:
264 ifq = &ipintrq;
264 inq = &ipintrq;
265 isr = NETISR_IP;
266 break;
267#endif
268#ifdef INET6
269 case AF_INET6:
270 m->m_flags |= M_LOOP;
265 isr = NETISR_IP;
266 break;
267#endif
268#ifdef INET6
269 case AF_INET6:
270 m->m_flags |= M_LOOP;
271 ifq = &ip6intrq;
271 inq = &ip6intrq;
272 isr = NETISR_IPV6;
273 break;
274#endif
275#ifdef IPX
276 case AF_IPX:
272 isr = NETISR_IPV6;
273 break;
274#endif
275#ifdef IPX
276 case AF_IPX:
277 ifq = &ipxintrq;
277 inq = &ipxintrq;
278 isr = NETISR_IPX;
279 break;
280#endif
281#ifdef NS
282 case AF_NS:
278 isr = NETISR_IPX;
279 break;
280#endif
281#ifdef NS
282 case AF_NS:
283 ifq = &nsintrq;
283 inq = &nsintrq;
284 isr = NETISR_NS;
285 break;
286#endif
287#ifdef NETATALK
288 case AF_APPLETALK:
284 isr = NETISR_NS;
285 break;
286#endif
287#ifdef NETATALK
288 case AF_APPLETALK:
289 ifq = &atintrq2;
289 inq = &atintrq2;
290 isr = NETISR_ATALK;
291 break;
292#endif NETATALK
293 default:
294 printf("if_simloop: can't handle af=%d\n", af);
295 m_freem(m);
296 return (EAFNOSUPPORT);
297 }
290 isr = NETISR_ATALK;
291 break;
292#endif NETATALK
293 default:
294 printf("if_simloop: can't handle af=%d\n", af);
295 m_freem(m);
296 return (EAFNOSUPPORT);
297 }
298 s = splimp();
299 if (IF_QFULL(ifq)) {
300 IF_DROP(ifq);
301 m_freem(m);
302 splx(s);
303 return (ENOBUFS);
304 }
305 IF_ENQUEUE(ifq, m);
306 schednetisr(isr);
307 ifp->if_ipackets++;
308 ifp->if_ibytes += m->m_pkthdr.len;
298 ifp->if_ipackets++;
299 ifp->if_ibytes += m->m_pkthdr.len;
309 splx(s);
300 (void) IF_HANDOFF(inq, m, NULL);
301 schednetisr(isr);
310 return (0);
311}
312
313/* ARGSUSED */
314static void
315lortrequest(cmd, rt, sa)
316 int cmd;
317 struct rtentry *rt;

--- 74 unchanged lines hidden ---
302 return (0);
303}
304
305/* ARGSUSED */
306static void
307lortrequest(cmd, rt, sa)
308 int cmd;
309 struct rtentry *rt;

--- 74 unchanged lines hidden ---