typed mbufs
[unix-history] / usr / src / sys / net / if_loop.c
index e0b04e1..e783861 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_loop.c       4.8     82/03/28        */
+/*     if_loop.c       4.15    82/10/13        */
 
 /*
  * Loopback interface driver for protocol testing and timing.
 
 /*
  * Loopback interface driver for protocol testing and timing.
@@ -8,12 +8,15 @@
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
-#include "../net/in.h"
-#include "../net/in_systm.h"
+#include "../netinet/in.h"
+#include "../netinet/in_systm.h"
 #include "../net/if.h"
 #include "../net/if.h"
-#include "../net/ip.h"
-#include "../net/ip_var.h"
-#include "../h/mtpr.h"
+#include "../net/netisr.h"
+#include "../netinet/ip.h"
+#include "../netinet/ip_var.h"
+#include "../vax/mtpr.h"
+#include "../net/route.h"
+#include <errno.h>
 
 #define        LONET   127
 #define        LOMTU   (1024+512)
 
 #define        LONET   127
 #define        LOMTU   (1024+512)
@@ -35,6 +38,7 @@ loattach()
        ifp->if_flags = IFF_UP;
        ifp->if_output = looutput;
        if_attach(ifp);
        ifp->if_flags = IFF_UP;
        ifp->if_output = looutput;
        if_attach(ifp);
+       if_rtinit(ifp, RTF_UP);
 }
 
 looutput(ifp, m0, dst)
 }
 
 looutput(ifp, m0, dst)
@@ -55,7 +59,7 @@ looutput(ifp, m0, dst)
                        IF_DROP(ifq);
                        m_freem(m0);
                        splx(s);
                        IF_DROP(ifq);
                        m_freem(m0);
                        splx(s);
-                       return (0);
+                       return (ENOBUFS);
                }
                IF_ENQUEUE(ifq, m0);
                schednetisr(NETISR_IP);
                }
                IF_ENQUEUE(ifq, m0);
                schednetisr(NETISR_IP);
@@ -66,9 +70,9 @@ looutput(ifp, m0, dst)
                printf("lo%d: can't handle af%d\n", ifp->if_unit,
                        dst->sa_family);
                m_freem(m0);
                printf("lo%d: can't handle af%d\n", ifp->if_unit,
                        dst->sa_family);
                m_freem(m0);
-               return (0);
+               return (EAFNOSUPPORT);
        }
        ifp->if_ipackets++;
        splx(s);
        }
        ifp->if_ipackets++;
        splx(s);
-       return (1);
+       return (0);
 }
 }