libpcap fix for non-IPv6 build.
<http://www.sics.se/~assar/tcpdump_patches/1> From: Assar Westerlund <assar@sics.se>
This commit is contained in:
parent
3ebf39d355
commit
3c03d42af2
|
@ -18,7 +18,7 @@
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/ethertype.h,v 1.6 1999-10-07 23:46:40 mcr Exp $ (LBL)
|
* @(#) $Header: /tcpdump/master/libpcap/ethertype.h,v 1.7 1999-10-30 04:30:13 itojun Exp $ (LBL)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Types missing from some systems */
|
/* Types missing from some systems */
|
||||||
|
@ -71,6 +71,9 @@
|
||||||
#ifndef ETHERTYPE_AARP
|
#ifndef ETHERTYPE_AARP
|
||||||
#define ETHERTYPE_AARP 0x80f3
|
#define ETHERTYPE_AARP 0x80f3
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ETHERTYPE_IPV6
|
||||||
|
#define ETHERTYPE_IPV6 0x80f3
|
||||||
|
#endif
|
||||||
#ifndef ETHERTYPE_LOOPBACK
|
#ifndef ETHERTYPE_LOOPBACK
|
||||||
#define ETHERTYPE_LOOPBACK 0x9000
|
#define ETHERTYPE_LOOPBACK 0x9000
|
||||||
#endif
|
#endif
|
||||||
|
|
19
gencode.c
19
gencode.c
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.95 1999-10-19 15:18:29 itojun Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.96 1999-10-30 04:30:14 itojun Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -612,7 +612,7 @@ gen_linktype(proto)
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
else if (proto == ETHERTYPE_IPV6)
|
else if (proto == ETHERTYPE_IPV6)
|
||||||
proto = PPP_IPV6;
|
proto = PPP_IPV6;
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLT_PPP_BSDOS:
|
case DLT_PPP_BSDOS:
|
||||||
|
@ -631,7 +631,7 @@ gen_linktype(proto)
|
||||||
proto = PPP_IPV6;
|
proto = PPP_IPV6;
|
||||||
/* more to go? */
|
/* more to go? */
|
||||||
break;
|
break;
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
|
|
||||||
case ETHERTYPE_DN:
|
case ETHERTYPE_DN:
|
||||||
proto = PPP_DECNET;
|
proto = PPP_DECNET;
|
||||||
|
@ -654,7 +654,7 @@ gen_linktype(proto)
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
else if (proto == ETHERTYPE_IPV6)
|
else if (proto == ETHERTYPE_IPV6)
|
||||||
return (gen_cmp(0, BPF_W, (bpf_int32)htonl(AF_INET6)));
|
return (gen_cmp(0, BPF_W, (bpf_int32)htonl(AF_INET6)));
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
else
|
else
|
||||||
return gen_false();
|
return gen_false();
|
||||||
}
|
}
|
||||||
|
@ -1164,6 +1164,10 @@ gen_proto_abbrev(proto)
|
||||||
gen_and(b0, b1);
|
gen_and(b0, b1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef IPPROTO_PIM
|
||||||
|
#define IPPROTO_PIM 103
|
||||||
|
#endif
|
||||||
|
|
||||||
case Q_PIM:
|
case Q_PIM:
|
||||||
b1 = gen_proto(IPPROTO_PIM, Q_IP, Q_DEFAULT);
|
b1 = gen_proto(IPPROTO_PIM, Q_IP, Q_DEFAULT);
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
|
@ -1534,6 +1538,7 @@ gen_protochain(v, proto, dir)
|
||||||
s[i]->s.k = off_nl;
|
s[i]->s.k = off_nl;
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
|
#ifdef INET6
|
||||||
case Q_IPV6:
|
case Q_IPV6:
|
||||||
b0 = gen_linktype(ETHERTYPE_IPV6);
|
b0 = gen_linktype(ETHERTYPE_IPV6);
|
||||||
|
|
||||||
|
@ -1546,6 +1551,7 @@ gen_protochain(v, proto, dir)
|
||||||
s[i]->s.k = 40;
|
s[i]->s.k = 40;
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
bpf_error("unsupported proto to gen_protochain");
|
bpf_error("unsupported proto to gen_protochain");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
@ -1569,6 +1575,7 @@ gen_protochain(v, proto, dir)
|
||||||
fix2 = i;
|
fix2 = i;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
#ifdef INET6
|
||||||
if (proto == Q_IPV6) {
|
if (proto == Q_IPV6) {
|
||||||
int v6start, v6end, v6advance, j;
|
int v6start, v6end, v6advance, j;
|
||||||
|
|
||||||
|
@ -1664,7 +1671,9 @@ gen_protochain(v, proto, dir)
|
||||||
/* fixup */
|
/* fixup */
|
||||||
for (j = v6start; j <= v6end; j++)
|
for (j = v6start; j <= v6end; j++)
|
||||||
s[j]->s.jt = s[v6advance];
|
s[j]->s.jt = s[v6advance];
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/* nop */
|
/* nop */
|
||||||
s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
|
s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
|
||||||
s[i]->s.k = 0;
|
s[i]->s.k = 0;
|
||||||
|
|
Reference in New Issue