summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ip.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-01-23 01:48:19 +0000
committerbrian <brian@FreeBSD.org>2000-01-23 01:48:19 +0000
commitc14760c27b30e0e6821d3afccccd572582d73526 (patch)
treeaef40fb40de8ecfcde00e41bbe45982c893c1d84 /usr.sbin/ppp/ip.c
parent8efad4996bb383d485f1c8ae1ac16059954d0132 (diff)
downloadFreeBSD-src-c14760c27b30e0e6821d3afccccd572582d73526.zip
FreeBSD-src-c14760c27b30e0e6821d3afccccd572582d73526.tar.gz
Handle the availability of TUNSIFHEAD. If it's there, use it.
For the moment this is just overhead, but it'll be used for INET6 support later.
Diffstat (limited to 'usr.sbin/ppp/ip.c')
-rw-r--r--usr.sbin/ppp/ip.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index efd096d..f33c3d9 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",
OpenPOWER on IntegriCloud