* Copyright (c) 1982, 1986 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* @(#)if_loop.c 7.9 (Berkeley) %G%
* Loopback interface driver for protocol testing and timing.
#include "../net/if_types.h"
#include "../net/netisr.h"
#include "../net/route.h"
#include "machine/mtpr.h"
#include "../netinet/in.h"
#include "../netinet/in_systm.h"
#include "../netinet/in_var.h"
#include "../netinet/ip.h"
#include "../netns/ns_if.h"
#include "../netiso/iso.h"
#include "../netiso/iso_var.h"
int looutput(), loioctl();
register struct ifnet
*ifp
= &loif
;
ifp
->if_flags
= IFF_LOOPBACK
;
ifp
->if_output
= looutput
;
struct mbuf
*Loop_Sanity
;
register struct ifqueue
*ifq
;
if ((m
->m_flags
& M_PKTHDR
) == 0)
panic("looutput no HDR");
{struct mbuf
*mm
; int mlen
= 0;
for (mm
= m
; m
; m
= m
->m_next
) /* XXX debugging code -- sklower */
if (mlen
!= m
->m_pkthdr
.len
) {
Loop_Sanity
= m_copy(m
, 0, (int)M_COPYALL
);
ifp
->if_obytes
+= m
->m_pkthdr
.len
;
switch (dst
->sa_family
) {
printf("lo%d: can't handle af%d\n", ifp
->if_unit
,
ifp
->if_ibytes
+= m
->m_pkthdr
.len
;
* Process an ioctl request.
register struct ifnet
*ifp
;
* Everything else is done at a higher level.