diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-01-23 01:48:19 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-01-23 01:48:19 +0000 |
commit | 3a7b6d76a72ffdc941a7cdfe6e0ef61e01ee33ea (patch) | |
tree | cd66909681e2f149d912b8caf45afc9200f576c1 /usr.sbin/ppp/ip.c | |
parent | f3c2973db71e760ef510bfb9ec8d3118663d4579 (diff) | |
download | src-test2-3a7b6d76a72ffdc941a7cdfe6e0ef61e01ee33ea.tar.gz src-test2-3a7b6d76a72ffdc941a7cdfe6e0ef61e01ee33ea.zip |
Notes
Diffstat (limited to 'usr.sbin/ppp/ip.c')
-rw-r--r-- | usr.sbin/ppp/ip.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index efd096dd6c4b..f33c3d93af37 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -24,9 +24,7 @@ * and optionaly record it into log. */ #include <sys/param.h> -#if defined(__OpenBSD__) || defined(__NetBSD__) #include <sys/socket.h> -#endif #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> @@ -492,6 +490,7 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) int nb, nw; struct tun_data tun; struct ip *pip; + char *data; if (bundle->ncp.ipcp.fsm.state != ST_OPENED) { log_Printf(LogWARN, "ip_Input: IPCP not open - packet dropped\n"); @@ -500,7 +499,6 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) } m_settype(bp, MB_IPIN); - tun_fill_header(tun, AF_INET); nb = m_length(bp); if (nb > sizeof tun.data) { log_Printf(LogWARN, "ip_Input: %s: Packet too large (got %d, max %d)\n", @@ -519,8 +517,14 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) ipcp_AddInOctets(&bundle->ncp.ipcp, nb); - nb += sizeof tun - sizeof tun.data; - nw = write(bundle->dev.fd, &tun, nb); + if (bundle->dev.header) { + tun.family = htonl(AF_INET); + nb += sizeof tun - sizeof tun.data; + data = (char *)&tun; + } else + data = tun.data; + + nw = write(bundle->dev.fd, data, nb); if (nw != nb) { if (nw == -1) log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %s\n", |