summaryrefslogtreecommitdiffstats
path: root/lib/libpcap
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-06-22 16:56:00 +0000
committerache <ache@FreeBSD.org>1995-06-22 16:56:00 +0000
commit215845d698e3fd79f01c55d8f15b61d453eeae0d (patch)
tree8b5a6afde754162227b300db15e66786f1f30340 /lib/libpcap
parent0f32fe3a4e1c4bb785af521f63a6c4dfac5c7dd4 (diff)
downloadFreeBSD-src-215845d698e3fd79f01c55d8f15b61d453eeae0d.zip
FreeBSD-src-215845d698e3fd79f01c55d8f15b61d453eeae0d.tar.gz
Fix handling NULL-encapsulated interfaces (lo & tun)
Reviewed by: wollman Submitted by: dvv@sprint.net
Diffstat (limited to 'lib/libpcap')
-rw-r--r--lib/libpcap/gencode.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c
index 0c7c049..3f237c1 100644
--- a/lib/libpcap/gencode.c
+++ b/lib/libpcap/gencode.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static char rcsid[] =
- "@(#) $Header: gencode.c,v 1.55 94/06/20 19:07:53 leres Exp $ (LBL)";
+ "@(#) $Header: /home/ncvs/src/lib/libpcap/gencode.c,v 1.1.1.1 1995/01/20 04:13:04 jkh Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -471,8 +471,8 @@ init_linktype(type)
return;
case DLT_NULL:
- off_linktype = -1;
- off_nl = 0;
+ off_linktype = 0;
+ off_nl = 4;
return;
case DLT_PPP:
@@ -543,6 +543,15 @@ gen_linktype(proto)
if (proto == ETHERTYPE_IP)
proto = 0x0021; /* XXX - need ppp.h defs */
break;
+
+ case DLT_NULL:
+ if (proto == ETHERTYPE_IP) {
+ proto = htonl(AF_INET); /* loopback & tun put */
+ /* sa_family into */
+ /* prepended word */
+ return gen_cmp(off_linktype, BPF_W, (long)proto);
+ }
+ break;
}
return gen_cmp(off_linktype, BPF_H, (long)proto);
}
OpenPOWER on IntegriCloud