projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typed mbufs
[unix-history]
/
usr
/
src
/
sys
/
net
/
if_loop.c
diff --git
a/usr/src/sys/net/if_loop.c
b/usr/src/sys/net/if_loop.c
index
ac8830e
..
e783861
100644
(file)
--- a/
usr/src/sys/net/if_loop.c
+++ b/
usr/src/sys/net/if_loop.c
@@
-1,4
+1,4
@@
-/* if_loop.c 4.
7 82/03/19
*/
+/* 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 "../net
inet
/in.h"
+#include "../net
inet
/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)
@@
-24,47
+27,52
@@
int looutput();
loattach()
{
register struct ifnet *ifp = &loif;
loattach()
{
register struct ifnet *ifp = &loif;
+ register struct sockaddr_in *sin;
ifp->if_name = "lo";
ifp->if_mtu = LOMTU;
ifp->if_net = LONET;
ifp->if_name = "lo";
ifp->if_mtu = LOMTU;
ifp->if_net = LONET;
- ifp->if_addr = if_makeaddr(ifp->if_net, 0);
+ sin = (struct sockaddr_in *)&ifp->if_addr;
+ sin->sin_family = AF_INET;
+ sin->sin_addr = if_makeaddr(ifp->if_net, 0);
+ ifp->if_flags = IFF_UP;
ifp->if_output = looutput;
if_attach(ifp);
ifp->if_output = looutput;
if_attach(ifp);
+ if_rtinit(ifp, RTF_UP);
}
}
-looutput(ifp, m0,
pf
)
+looutput(ifp, m0,
dst
)
struct ifnet *ifp;
struct mbuf *m0;
struct ifnet *ifp;
struct mbuf *m0;
-
int pf
;
+
struct sockaddr *dst
;
{
int s = splimp();
register struct ifqueue *ifq;
ifp->if_opackets++;
{
int s = splimp();
register struct ifqueue *ifq;
ifp->if_opackets++;
- switch (
pf
) {
+ switch (
dst->sa_family
) {
#ifdef INET
#ifdef INET
- case
P
F_INET:
+ case
A
F_INET:
ifq = &ipintrq;
if (IF_QFULL(ifq)) {
IF_DROP(ifq);
ifq = &ipintrq;
if (IF_QFULL(ifq)) {
IF_DROP(ifq);
-
(void)
m_freem(m0);
+ m_freem(m0);
splx(s);
splx(s);
- return (
0
);
+ return (
ENOBUFS
);
}
IF_ENQUEUE(ifq, m0);
schednetisr(NETISR_IP);
break;
#endif
}
IF_ENQUEUE(ifq, m0);
schednetisr(NETISR_IP);
break;
#endif
-
default:
splx(s);
default:
splx(s);
- printf("lo%d: can't encapsulate pf%d\n", ifp->if_unit, pf);
- (void) m_freem(m0);
- return (0);
+ printf("lo%d: can't handle af%d\n", ifp->if_unit,
+ dst->sa_family);
+ m_freem(m0);
+ return (EAFNOSUPPORT);
}
ifp->if_ipackets++;
splx(s);
}
ifp->if_ipackets++;
splx(s);
- return (
1
);
+ return (
0
);
}
}