Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/libpcap resolve conflicts.
details: https://anonhg.NetBSD.org/src/rev/0661e56342d2
branches: trunk
changeset: 325603:0661e56342d2
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 31 17:08:14 2013 +0000
description:
resolve conflicts.
diffstat:
external/bsd/libpcap/dist/gencode.c | 226 ++++----
external/bsd/libpcap/dist/grammar.y | 25 +-
external/bsd/libpcap/dist/optimize.c | 202 +-----
external/bsd/libpcap/dist/pcap-bpf.c | 339 ++++++------
external/bsd/libpcap/dist/pcap.3pcap.in | 46 +-
external/bsd/libpcap/dist/pcap.c | 510 ++++++++++++++++--
external/bsd/libpcap/dist/pcap/bpf.h | 55 +-
external/bsd/libpcap/dist/pcap/pcap.h | 38 +-
external/bsd/libpcap/dist/pcap_open_offline.3pcap.in | 39 +-
external/bsd/libpcap/dist/scanner.l | 29 +-
external/bsd/libpcap/dist/sf-pcap-ng.c | 394 ++++++++++---
external/bsd/libpcap/dist/sf-pcap.c | 193 +++++-
external/bsd/libpcap/include/config.h | 29 +-
13 files changed, 1448 insertions(+), 677 deletions(-)
diffs (truncated from 4426 to 300 lines):
diff -r 3e8e315a2009 -r 0661e56342d2 external/bsd/libpcap/dist/gencode.c
--- a/external/bsd/libpcap/dist/gencode.c Tue Dec 31 16:57:18 2013 +0000
+++ b/external/bsd/libpcap/dist/gencode.c Tue Dec 31 17:08:14 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gencode.c,v 1.5 2013/04/06 17:29:53 christos Exp $ */
+/* $NetBSD: gencode.c,v 1.6 2013/12/31 17:08:23 christos Exp $ */
/*#define CHASE_CHAIN*/
/*
@@ -87,7 +87,7 @@
#include "pcap/sll.h"
#include "pcap/ipnet.h"
#include "arcnet.h"
-#if defined(PF_PACKET) && defined(SO_ATTACH_FILTER)
+#if defined(linux) && defined(PF_PACKET) && defined(SO_ATTACH_FILTER)
#include <linux/types.h>
#include <linux/if_packet.h>
#include <linux/filter.h>
@@ -110,6 +110,18 @@
#define ETHERMTU 1500
+#ifndef IPPROTO_HOPOPTS
+#define IPPROTO_HOPOPTS 0
+#endif
+#ifndef IPPROTO_ROUTING
+#define IPPROTO_ROUTING 43
+#endif
+#ifndef IPPROTO_FRAGMENT
+#define IPPROTO_FRAGMENT 44
+#endif
+#ifndef IPPROTO_DSTOPTS
+#define IPPROTO_DSTOPTS 60
+#endif
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
#endif
@@ -132,9 +144,7 @@
#endif
/* XXX */
-#ifdef PCAP_FDDIPAD
static int pcap_fddipad;
-#endif
/* VARARGS */
void
@@ -264,20 +274,16 @@
static struct block *gen_ipfrag(void);
static struct block *gen_portatom(int, bpf_int32);
static struct block *gen_portrangeatom(int, bpf_int32, bpf_int32);
-#ifdef INET6
static struct block *gen_portatom6(int, bpf_int32);
static struct block *gen_portrangeatom6(int, bpf_int32, bpf_int32);
-#endif
struct block *gen_portop(int, int, int);
static struct block *gen_port(int, int, int);
struct block *gen_portrangeop(int, int, int, int);
static struct block *gen_portrange(int, int, int, int);
-#ifdef INET6
struct block *gen_portop6(int, int, int);
static struct block *gen_port6(int, int, int);
struct block *gen_portrangeop6(int, int, int, int);
static struct block *gen_portrange6(int, int, int, int);
-#endif
static int lookup_proto(const char *, int);
static struct block *gen_protochain(int, int, int);
static struct block *gen_proto(int, int, int);
@@ -428,6 +434,15 @@
const char * volatile xbuf = buf;
u_int len;
+ /*
+ * If this pcap_t hasn't been activated, it doesn't have a
+ * link-layer type, so we can't use it.
+ */
+ if (!p->activated) {
+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+ "not-yet-activated pcap_t passed to pcap_compile");
+ return (-1);
+ }
no_optimize = 0;
n_errors = 0;
root = NULL;
@@ -862,6 +877,7 @@
* These are offsets for the MTP2 fields.
*/
static u_int off_li;
+static u_int off_li_hsl;
/*
* These are offsets for the MTP3 fields.
@@ -911,9 +927,7 @@
pcap_t *p;
{
linktype = pcap_datalink(p);
-#ifdef PCAP_FDDIPAD
pcap_fddipad = p->fddipad;
-#endif
/*
* Assume it's not raw ATM with a pseudo-header, for now.
@@ -935,6 +949,7 @@
* And assume we're not doing SS7.
*/
off_li = -1;
+ off_li_hsl = -1;
off_sio = -1;
off_opc = -1;
off_dpc = -1;
@@ -1050,13 +1065,9 @@
* XXX - should we generate code to check for SNAP?
*/
off_linktype = 13;
-#ifdef PCAP_FDDIPAD
off_linktype += pcap_fddipad;
-#endif
off_macpl = 13; /* FDDI MAC header length */
-#ifdef PCAP_FDDIPAD
off_macpl += pcap_fddipad;
-#endif
off_nl = 8; /* 802.2+SNAP */
off_nl_nosnap = 3; /* 802.2 */
return;
@@ -1327,6 +1338,13 @@
off_nl_nosnap = -1; /* no 802.2 LLC */
return;
+ case DLT_BACNET_MS_TP:
+ off_linktype = -1;
+ off_macpl = -1;
+ off_nl = -1;
+ off_nl_nosnap = -1;
+ return;
+
case DLT_JUNIPER_SERVICES:
off_linktype = 12;
off_macpl = -1; /* L3 proto location dep. on cookie type */
@@ -1367,6 +1385,7 @@
case DLT_MTP2:
off_li = 2;
+ off_li_hsl = 4;
off_sio = 3;
off_opc = 4;
off_dpc = 4;
@@ -1379,6 +1398,7 @@
case DLT_MTP2_WITH_PHDR:
off_li = 6;
+ off_li_hsl = 8;
off_sio = 7;
off_opc = 8;
off_dpc = 8;
@@ -1391,6 +1411,7 @@
case DLT_ERF:
off_li = 22;
+ off_li_hsl = 24;
off_sio = 23;
off_opc = 24;
off_dpc = 24;
@@ -2835,11 +2856,9 @@
proto = PPP_IP;
break;
-#ifdef INET6
case ETHERTYPE_IPV6:
proto = PPP_IPV6;
break;
-#endif
case ETHERTYPE_DN:
proto = PPP_DECNET;
@@ -3047,11 +3066,10 @@
case ETHERTYPE_IP:
/* Check for a version number of 4. */
return gen_mcmp(OR_LINK, 0, BPF_B, 0x40, 0xF0);
-#ifdef INET6
+
case ETHERTYPE_IPV6:
/* Check for a version number of 6. */
return gen_mcmp(OR_LINK, 0, BPF_B, 0x60, 0xF0);
-#endif
default:
return gen_false(); /* always false */
@@ -3075,10 +3093,8 @@
/*
* Raw IPv6, so no type field.
*/
-#ifdef INET6
if (proto == ETHERTYPE_IPV6)
return gen_true(); /* always true */
-#endif
/* Checking for something other than IPv6; always false */
return gen_false();
@@ -3184,8 +3200,7 @@
* Then we run it through "htonl()", and
* generate code to compare against the result.
*/
- if (bpf_pcap->sf.rfile != NULL &&
- bpf_pcap->sf.swapped)
+ if (bpf_pcap->rfile != NULL && bpf_pcap->swapped)
proto = SWAPLONG(proto);
proto = htonl(proto);
}
@@ -3200,11 +3215,9 @@
if (proto == ETHERTYPE_IP)
return (gen_cmp(OR_LINK, offsetof(struct pfloghdr, af),
BPF_B, (bpf_int32)AF_INET));
-#ifdef INET6
else if (proto == ETHERTYPE_IPV6)
return (gen_cmp(OR_LINK, offsetof(struct pfloghdr, af),
BPF_B, (bpf_int32)AF_INET6));
-#endif /* INET6 */
else
return gen_false();
/*NOTREACHED*/
@@ -3222,11 +3235,9 @@
default:
return gen_false();
-#ifdef INET6
case ETHERTYPE_IPV6:
return (gen_cmp(OR_LINK, off_linktype, BPF_B,
(bpf_int32)ARCTYPE_INET6));
-#endif /* INET6 */
case ETHERTYPE_IP:
b0 = gen_cmp(OR_LINK, off_linktype, BPF_B,
@@ -3278,13 +3289,11 @@
*/
return gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | 0xcc);
-#ifdef INET6
case ETHERTYPE_IPV6:
/*
* Check for the special NLPID for IPv6.
*/
return gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | 0x8e);
-#endif
case LLCSAP_ISONS:
/*
@@ -3346,6 +3355,9 @@
*/
return gen_mcmp(OR_LINK, 0, BPF_W, 0x4d474300, 0xffffff00); /* compare the magic number */
+ case DLT_BACNET_MS_TP:
+ return gen_mcmp(OR_LINK, 0, BPF_W, 0x55FF0000, 0xffff0000);
+
case DLT_IPNET:
return gen_ipnet_linktype(proto);
@@ -3631,7 +3643,7 @@
gen_and(b0, b1);
return b1;
}
-#endif /*INET6*/
+#endif
static struct block *
gen_ehostop(eaddr, dir)
@@ -3700,18 +3712,10 @@
switch (dir) {
case Q_SRC:
-#ifdef PCAP_FDDIPAD
return gen_bcmp(OR_LINK, 6 + 1 + pcap_fddipad, 6, eaddr);
-#else
- return gen_bcmp(OR_LINK, 6 + 1, 6, eaddr);
-#endif
case Q_DST:
-#ifdef PCAP_FDDIPAD
return gen_bcmp(OR_LINK, 0 + 1 + pcap_fddipad, 6, eaddr);
-#else
- return gen_bcmp(OR_LINK, 0 + 1, 6, eaddr);
-#endif
case Q_AND:
b0 = gen_fhostop(eaddr, Q_SRC);
@@ -4509,13 +4513,11 @@
case Q_MOPRC:
bpf_error("MOPRC host filtering not implemented");
-#ifdef INET6
case Q_IPV6:
bpf_error("'ip6' modifier applied to ip host");
case Q_ICMPV6:
bpf_error("'icmp6' modifier applied to %s", typestr);
-#endif /* INET6 */
case Q_AH:
bpf_error("'ah' modifier applied to %s", typestr);
@@ -4574,6 +4576,9 @@
case Q_DEFAULT:
Home |
Main Index |
Thread Index |
Old Index