resolve merge conflicts
MFC after: 1 month
This commit is contained in:
parent
47aafbd8f9
commit
ff252dbedb
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.24 2005/06/20 21:52:53 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.34 2005/09/05 09:08:04 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -86,7 +86,6 @@ static const char rcsid[] _U_ =
|
||||
#endif /*INET6*/
|
||||
#include <pcap-namedb.h>
|
||||
|
||||
#undef ETHERMTU
|
||||
#define ETHERMTU 1500
|
||||
|
||||
#ifndef IPPROTO_SCTP
|
||||
@ -103,8 +102,8 @@ static const char rcsid[] _U_ =
|
||||
static jmp_buf top_ctx;
|
||||
static pcap_t *bpf_pcap;
|
||||
|
||||
/* Hack for updating VLAN, MPLS offsets. */
|
||||
static u_int orig_linktype = -1U, orig_nl = -1U;
|
||||
/* Hack for updating VLAN, MPLS, and PPPoE offsets. */
|
||||
static u_int orig_linktype = -1U, orig_nl = -1U, label_stack_depth = -1U;
|
||||
|
||||
/* XXX */
|
||||
#ifdef PCAP_FDDIPAD
|
||||
@ -208,6 +207,7 @@ static struct block *gen_thostop(const u_char *, int);
|
||||
static struct block *gen_wlanhostop(const u_char *, int);
|
||||
static struct block *gen_ipfchostop(const u_char *, int);
|
||||
static struct block *gen_dnhostop(bpf_u_int32, int);
|
||||
static struct block *gen_mpls_linktype(int);
|
||||
static struct block *gen_host(bpf_u_int32, bpf_u_int32, int, int);
|
||||
#ifdef INET6
|
||||
static struct block *gen_host6(struct in6_addr *, struct in6_addr *, int, int);
|
||||
@ -781,6 +781,9 @@ init_linktype(p)
|
||||
off_proto = -1;
|
||||
off_payload = -1;
|
||||
|
||||
/*
|
||||
* And assume we're not doing SS7.
|
||||
*/
|
||||
off_sio = -1;
|
||||
off_opc = -1;
|
||||
off_dpc = -1;
|
||||
@ -793,6 +796,7 @@ init_linktype(p)
|
||||
|
||||
orig_linktype = -1;
|
||||
orig_nl = -1;
|
||||
label_stack_depth = 0;
|
||||
|
||||
reg_ll_size = -1;
|
||||
|
||||
@ -1116,8 +1120,12 @@ init_linktype(p)
|
||||
off_nl_nosnap = PFLOG_HDRLEN; /* no 802.2 LLC */
|
||||
return;
|
||||
|
||||
case DLT_JUNIPER_MFR:
|
||||
case DLT_JUNIPER_MLFR:
|
||||
case DLT_JUNIPER_MLPPP:
|
||||
case DLT_JUNIPER_PPP:
|
||||
case DLT_JUNIPER_CHDLC:
|
||||
case DLT_JUNIPER_FRELAY:
|
||||
off_linktype = 4;
|
||||
off_nl = 4;
|
||||
off_nl_nosnap = -1; /* no 802.2 LLC */
|
||||
@ -1138,6 +1146,7 @@ init_linktype(p)
|
||||
/* frames captured on a Juniper PPPoE service PIC
|
||||
* contain raw ethernet frames */
|
||||
case DLT_JUNIPER_PPPOE:
|
||||
case DLT_JUNIPER_ETHER:
|
||||
off_linktype = 16;
|
||||
off_nl = 18; /* Ethernet II */
|
||||
off_nl_nosnap = 21; /* 802.3+802.2 */
|
||||
@ -1854,6 +1863,25 @@ gen_linktype(proto)
|
||||
{
|
||||
struct block *b0, *b1, *b2;
|
||||
|
||||
/* are we checking MPLS-encapsulated packets? */
|
||||
if (label_stack_depth > 0) {
|
||||
switch (proto) {
|
||||
case ETHERTYPE_IP:
|
||||
case PPP_IP:
|
||||
/* FIXME add other L3 proto IDs */
|
||||
return gen_mpls_linktype(Q_IP);
|
||||
|
||||
case ETHERTYPE_IPV6:
|
||||
case PPP_IPV6:
|
||||
/* FIXME add other L3 proto IDs */
|
||||
return gen_mpls_linktype(Q_IPV6);
|
||||
|
||||
default:
|
||||
bpf_error("unsupported protocol over mpls");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
switch (linktype) {
|
||||
|
||||
case DLT_EN10MB:
|
||||
@ -2243,6 +2271,7 @@ gen_linktype(proto)
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
|
||||
case DLT_JUNIPER_MFR:
|
||||
case DLT_JUNIPER_MLFR:
|
||||
case DLT_JUNIPER_MLPPP:
|
||||
case DLT_JUNIPER_ATM1:
|
||||
@ -2253,6 +2282,10 @@ gen_linktype(proto)
|
||||
case DLT_JUNIPER_ES:
|
||||
case DLT_JUNIPER_MONITOR:
|
||||
case DLT_JUNIPER_SERVICES:
|
||||
case DLT_JUNIPER_ETHER:
|
||||
case DLT_JUNIPER_PPP:
|
||||
case DLT_JUNIPER_FRELAY:
|
||||
case DLT_JUNIPER_CHDLC:
|
||||
/* just lets verify the magic number for now -
|
||||
* on ATM we may have up to 6 different encapsulations on the wire
|
||||
* and need a lot of heuristics to figure out that the payload
|
||||
@ -3037,6 +3070,40 @@ gen_dnhostop(addr, dir)
|
||||
return b1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a check for IPv4 or IPv6 for MPLS-encapsulated packets;
|
||||
* test the bottom-of-stack bit, and then check the version number
|
||||
* field in the IP header.
|
||||
*/
|
||||
static struct block *
|
||||
gen_mpls_linktype(proto)
|
||||
int proto;
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
switch (proto) {
|
||||
|
||||
case Q_IP:
|
||||
/* match the bottom-of-stack bit */
|
||||
b0 = gen_mcmp(OR_NET, -2, BPF_B, 0x01, 0x01);
|
||||
/* match the IPv4 version number */
|
||||
b1 = gen_mcmp(OR_NET, 0, BPF_B, 0x40, 0xf0);
|
||||
gen_and(b0, b1);
|
||||
return b1;
|
||||
|
||||
case Q_IPV6:
|
||||
/* match the bottom-of-stack bit */
|
||||
b0 = gen_mcmp(OR_NET, -2, BPF_B, 0x01, 0x01);
|
||||
/* match the IPv4 version number */
|
||||
b1 = gen_mcmp(OR_NET, 0, BPF_B, 0x60, 0xf0);
|
||||
gen_and(b0, b1);
|
||||
return b1;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_host(addr, mask, proto, dir)
|
||||
bpf_u_int32 addr;
|
||||
@ -3050,11 +3117,15 @@ gen_host(addr, mask, proto, dir)
|
||||
|
||||
case Q_DEFAULT:
|
||||
b0 = gen_host(addr, mask, Q_IP, dir);
|
||||
if (off_linktype != (u_int)-1) {
|
||||
b1 = gen_host(addr, mask, Q_ARP, dir);
|
||||
gen_or(b0, b1);
|
||||
b0 = gen_host(addr, mask, Q_RARP, dir);
|
||||
gen_or(b1, b0);
|
||||
/*
|
||||
* Only check for non-IPv4 addresses if we're not
|
||||
* checking MPLS-encapsulated packets.
|
||||
*/
|
||||
if (label_stack_depth == 0) {
|
||||
b1 = gen_host(addr, mask, Q_ARP, dir);
|
||||
gen_or(b0, b1);
|
||||
b0 = gen_host(addr, mask, Q_RARP, dir);
|
||||
gen_or(b1, b0);
|
||||
}
|
||||
return b0;
|
||||
|
||||
@ -4396,6 +4467,7 @@ gen_proto(v, proto, dir)
|
||||
*
|
||||
* So we always check for ETHERTYPE_IP.
|
||||
*/
|
||||
|
||||
b0 = gen_linktype(ETHERTYPE_IP);
|
||||
#ifndef CHASE_CHAIN
|
||||
b1 = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)v);
|
||||
@ -5986,6 +6058,7 @@ gen_inbound(dir)
|
||||
}
|
||||
break;
|
||||
|
||||
case DLT_JUNIPER_MFR:
|
||||
case DLT_JUNIPER_MLFR:
|
||||
case DLT_JUNIPER_MLPPP:
|
||||
case DLT_JUNIPER_ATM1:
|
||||
@ -5996,6 +6069,10 @@ gen_inbound(dir)
|
||||
case DLT_JUNIPER_ES:
|
||||
case DLT_JUNIPER_MONITOR:
|
||||
case DLT_JUNIPER_SERVICES:
|
||||
case DLT_JUNIPER_ETHER:
|
||||
case DLT_JUNIPER_PPP:
|
||||
case DLT_JUNIPER_FRELAY:
|
||||
case DLT_JUNIPER_CHDLC:
|
||||
/* juniper flags (including direction) are stored
|
||||
* the byte after the 3-byte magic number */
|
||||
if (dir) {
|
||||
@ -6039,7 +6116,7 @@ gen_pf_ifname(const char *ifname)
|
||||
return (b0);
|
||||
}
|
||||
|
||||
/* PF firewall log matched interface */
|
||||
/* PF firewall log ruleset name */
|
||||
struct block *
|
||||
gen_pf_ruleset(char *ruleset)
|
||||
{
|
||||
@ -6178,7 +6255,11 @@ struct block *
|
||||
gen_vlan(vlan_num)
|
||||
int vlan_num;
|
||||
{
|
||||
struct block *b0;
|
||||
struct block *b0, *b1;
|
||||
|
||||
/* can't check for VLAN-encapsulated packets inside MPLS */
|
||||
if (label_stack_depth > 0)
|
||||
bpf_error("no VLAN match after MPLS");
|
||||
|
||||
/*
|
||||
* Change the offsets to point to the type and data fields within
|
||||
@ -6210,30 +6291,28 @@ gen_vlan(vlan_num)
|
||||
* be done assuming a VLAN, even though the "or" could be viewed
|
||||
* as meaning "or, if this isn't a VLAN packet...".
|
||||
*/
|
||||
orig_linktype = off_linktype; /* save original values */
|
||||
orig_nl = off_nl;
|
||||
orig_linktype = off_linktype; /* save original values */
|
||||
orig_nl = off_nl;
|
||||
|
||||
switch (linktype) {
|
||||
switch (linktype) {
|
||||
|
||||
case DLT_EN10MB:
|
||||
off_linktype += 4;
|
||||
off_nl_nosnap += 4;
|
||||
off_nl += 4;
|
||||
break;
|
||||
case DLT_EN10MB:
|
||||
off_linktype += 4;
|
||||
off_nl_nosnap += 4;
|
||||
off_nl += 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
bpf_error("no VLAN support for data link type %d",
|
||||
linktype);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
default:
|
||||
bpf_error("no VLAN support for data link type %d",
|
||||
linktype);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/* check for VLAN */
|
||||
b0 = gen_cmp(OR_LINK, orig_linktype, BPF_H, (bpf_int32)ETHERTYPE_8021Q);
|
||||
|
||||
/* If a specific VLAN is requested, check VLAN id */
|
||||
if (vlan_num >= 0) {
|
||||
struct block *b1;
|
||||
|
||||
b1 = gen_mcmp(OR_LINK, orig_nl, BPF_H, (bpf_int32)vlan_num,
|
||||
0x0fff);
|
||||
gen_and(b0, b1);
|
||||
@ -6250,7 +6329,7 @@ struct block *
|
||||
gen_mpls(label_num)
|
||||
int label_num;
|
||||
{
|
||||
struct block *b0;
|
||||
struct block *b0,*b1;
|
||||
|
||||
/*
|
||||
* Change the offsets to point to the type and data fields within
|
||||
@ -6261,44 +6340,46 @@ gen_mpls(label_num)
|
||||
*
|
||||
* XXX - this is a bit of a kludge. See comments in gen_vlan().
|
||||
*/
|
||||
orig_linktype = off_linktype; /* save original values */
|
||||
orig_nl = off_nl;
|
||||
|
||||
switch (linktype) {
|
||||
|
||||
case DLT_C_HDLC: /* fall through */
|
||||
case DLT_EN10MB:
|
||||
off_nl_nosnap += 4;
|
||||
off_nl += 4;
|
||||
|
||||
b0 = gen_cmp(OR_LINK, orig_linktype, BPF_H,
|
||||
(bpf_int32)ETHERTYPE_MPLS);
|
||||
break;
|
||||
|
||||
case DLT_PPP:
|
||||
off_nl_nosnap += 4;
|
||||
off_nl += 4;
|
||||
|
||||
b0 = gen_cmp(OR_LINK, orig_linktype, BPF_H,
|
||||
(bpf_int32)PPP_MPLS_UCAST);
|
||||
break;
|
||||
|
||||
/* FIXME add other DLT_s ...
|
||||
* for Frame-Relay/and ATM this may get messy due to SNAP headers
|
||||
* leave it for now */
|
||||
|
||||
default:
|
||||
bpf_error("no MPLS support for data link type %d",
|
||||
if (label_stack_depth > 0) {
|
||||
/* just match the bottom-of-stack bit clear */
|
||||
b0 = gen_mcmp(OR_LINK, orig_nl-2, BPF_B, 0, 0x01);
|
||||
} else {
|
||||
/*
|
||||
* Indicate that we're checking MPLS-encapsulated headers,
|
||||
* to make sure higher level code generators don't try to
|
||||
* match against IP-related protocols such as Q_ARP, Q_RARP
|
||||
* etc.
|
||||
*/
|
||||
switch (linktype) {
|
||||
|
||||
case DLT_C_HDLC: /* fall through */
|
||||
case DLT_EN10MB:
|
||||
b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
|
||||
(bpf_int32)ETHERTYPE_MPLS);
|
||||
break;
|
||||
|
||||
case DLT_PPP:
|
||||
b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
|
||||
(bpf_int32)PPP_MPLS_UCAST);
|
||||
break;
|
||||
|
||||
/* FIXME add other DLT_s ...
|
||||
* for Frame-Relay/and ATM this may get messy due to SNAP headers
|
||||
* leave it for now */
|
||||
|
||||
default:
|
||||
bpf_error("no MPLS support for data link type %d",
|
||||
linktype);
|
||||
b0 = NULL;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
b0 = NULL;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If a specific MPLS label is requested, check it */
|
||||
if (label_num >= 0) {
|
||||
struct block *b1;
|
||||
|
||||
label_num = label_num << 12; /* label is shifted 12 bits on the wire */
|
||||
b1 = gen_mcmp(OR_LINK, orig_nl, BPF_W, (bpf_int32)label_num,
|
||||
0xfffff000); /* only compare the first 20 bits */
|
||||
@ -6306,9 +6387,84 @@ gen_mpls(label_num)
|
||||
b0 = b1;
|
||||
}
|
||||
|
||||
off_nl_nosnap += 4;
|
||||
off_nl += 4;
|
||||
label_stack_depth++;
|
||||
return (b0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Support PPPOE discovery and session.
|
||||
*/
|
||||
struct block *
|
||||
gen_pppoed()
|
||||
{
|
||||
/* check for PPPoE discovery */
|
||||
return gen_linktype((bpf_int32)ETHERTYPE_PPPOED);
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_pppoes()
|
||||
{
|
||||
struct block *b0;
|
||||
|
||||
/*
|
||||
* Test against the PPPoE session link-layer type.
|
||||
*/
|
||||
b0 = gen_linktype((bpf_int32)ETHERTYPE_PPPOES);
|
||||
|
||||
/*
|
||||
* Change the offsets to point to the type and data fields within
|
||||
* the PPP packet.
|
||||
*
|
||||
* XXX - this is a bit of a kludge. If we were to split the
|
||||
* compiler into a parser that parses an expression and
|
||||
* generates an expression tree, and a code generator that
|
||||
* takes an expression tree (which could come from our
|
||||
* parser or from some other parser) and generates BPF code,
|
||||
* we could perhaps make the offsets parameters of routines
|
||||
* and, in the handler for an "AND" node, pass to subnodes
|
||||
* other than the PPPoE node the adjusted offsets.
|
||||
*
|
||||
* This would mean that "pppoes" would, instead of changing the
|
||||
* behavior of *all* tests after it, change only the behavior
|
||||
* of tests ANDed with it. That would change the documented
|
||||
* semantics of "pppoes", which might break some expressions.
|
||||
* However, it would mean that "(pppoes and ip) or ip" would check
|
||||
* both for VLAN-encapsulated IP and IP-over-Ethernet, rather than
|
||||
* checking only for VLAN-encapsulated IP, so that could still
|
||||
* be considered worth doing; it wouldn't break expressions
|
||||
* that are of the form "pppoes and ..." which I suspect are the
|
||||
* most common expressions involving "pppoes". "pppoes or ..."
|
||||
* doesn't necessarily do what the user would really want, now,
|
||||
* as all the "or ..." tests would be done assuming PPPoE, even
|
||||
* though the "or" could be viewed as meaning "or, if this isn't
|
||||
* a PPPoE packet...".
|
||||
*/
|
||||
orig_linktype = off_linktype; /* save original values */
|
||||
orig_nl = off_nl;
|
||||
|
||||
/*
|
||||
* The "network-layer" protocol is PPPoE, which has a 6-byte
|
||||
* PPPoE header, followed by PPP payload, so we set the
|
||||
* offsets to the network layer offset plus 6 bytes for
|
||||
* the PPPoE header plus the values appropriate for PPP when
|
||||
* encapsulated in Ethernet (which means there's no HDLC
|
||||
* encapsulation).
|
||||
*/
|
||||
off_linktype = orig_nl + 6;
|
||||
off_nl = orig_nl + 6 + 2;
|
||||
off_nl_nosnap = orig_nl + 6 + 2;
|
||||
|
||||
/*
|
||||
* Set the link-layer type to PPP, as all subsequent tests will
|
||||
* be on the encapsulated PPP header.
|
||||
*/
|
||||
linktype = DLT_PPP;
|
||||
|
||||
return b0;
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_atmfield_code(atmfield, jvalue, jtype, reverse)
|
||||
int atmfield;
|
||||
|
@ -19,7 +19,7 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.60.2.5 2005/06/20 21:30:17 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.60.2.6 2005/09/05 09:08:06 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -290,6 +290,9 @@ struct block *gen_inbound(int);
|
||||
struct block *gen_vlan(int);
|
||||
struct block *gen_mpls(int);
|
||||
|
||||
struct block *gen_pppoed(void);
|
||||
struct block *gen_pppoes(void);
|
||||
|
||||
struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse);
|
||||
struct block *gen_atmtype_abbrev(int type);
|
||||
struct block *gen_atmmulti_abbrev(int type);
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.4 2005/06/20 21:30:17 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.5 2005/09/05 09:08:06 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -132,6 +132,7 @@ pcap_parse()
|
||||
%token LEN
|
||||
%token IPV6 ICMPV6 AH ESP
|
||||
%token VLAN MPLS
|
||||
%token PPPOED PPPOES
|
||||
%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
|
||||
%token STP
|
||||
%token IPX
|
||||
@ -334,6 +335,8 @@ other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
|
||||
| VLAN { $$ = gen_vlan(-1); }
|
||||
| MPLS pnum { $$ = gen_mpls($2); }
|
||||
| MPLS { $$ = gen_mpls(-1); }
|
||||
| PPPOED { $$ = gen_pppoed(); }
|
||||
| PPPOES { $$ = gen_pppoes(); }
|
||||
| pfvar { $$ = $1; }
|
||||
;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.68.2.2 2005/05/03 18:54:36 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.68.2.6 2005/07/07 06:56:04 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef pcap_int_h
|
||||
@ -92,12 +92,21 @@ struct pcap_md {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DAG_API
|
||||
#ifdef HAVE_DAG_STREAMS_API
|
||||
u_char *dag_mem_bottom; /* DAG card current memory bottom pointer */
|
||||
u_char *dag_mem_top; /* DAG card current memory top pointer */
|
||||
#else
|
||||
void *dag_mem_base; /* DAG card memory base address */
|
||||
u_int dag_mem_bottom; /* DAG card current memory bottom pointer */
|
||||
u_int dag_mem_top; /* DAG card current memory top pointer */
|
||||
u_int dag_mem_bottom; /* DAG card current memory bottom offset */
|
||||
u_int dag_mem_top; /* DAG card current memory top offset */
|
||||
#endif /* HAVE_DAG_STREAMS_API */
|
||||
int dag_fcs_bits; /* Number of checksum bits from link layer */
|
||||
int dag_offset_flags; /* Flags to pass to dag_offset(). */
|
||||
#endif
|
||||
int dag_stream; /* DAG stream number */
|
||||
int dag_timeout; /* timeout specified to pcap_open_live.
|
||||
* Same as in linux above, introduce
|
||||
* generally? */
|
||||
#endif /* HAVE_DAG_API */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -152,7 +161,7 @@ struct pcap {
|
||||
u_char *pkt;
|
||||
|
||||
/* We're accepting only packets in this direction/these directions. */
|
||||
direction_t direction;
|
||||
pcap_direction_t direction;
|
||||
|
||||
/*
|
||||
* Methods.
|
||||
@ -160,7 +169,7 @@ struct pcap {
|
||||
int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *);
|
||||
int (*inject_op)(pcap_t *, const void *, size_t);
|
||||
int (*setfilter_op)(pcap_t *, struct bpf_program *);
|
||||
int (*setdirection_op)(pcap_t *, direction_t);
|
||||
int (*setdirection_op)(pcap_t *, pcap_direction_t);
|
||||
int (*set_datalink_op)(pcap_t *, int);
|
||||
int (*getnonblock_op)(pcap_t *, char *);
|
||||
int (*setnonblock_op)(pcap_t *, int, char *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" @(#) $Header: /tcpdump/master/libpcap/pcap.3,v 1.64.2.4 2005/06/03 20:36:56 guy Exp $
|
||||
.\" @(#) $Header: /tcpdump/master/libpcap/pcap.3,v 1.64.2.8 2005/09/07 08:29:17 guy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1994, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -82,7 +82,7 @@ int pcap_compile(pcap_t *p, struct bpf_program *fp,
|
||||
char *str, int optimize, bpf_u_int32 netmask)
|
||||
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
|
||||
void pcap_freecode(struct bpf_program *)
|
||||
int pcap_setdirection(pcap_t *p, direction_t d)
|
||||
int pcap_setdirection(pcap_t *p, pcap_direction_t d)
|
||||
.ft
|
||||
.LP
|
||||
.ft B
|
||||
@ -691,7 +691,11 @@ supplied to
|
||||
as the source link-layer address, if the header contains such an
|
||||
address, might be changed to be the address assigned to the interface on
|
||||
which the packet it sent, if the platform doesn't support sending
|
||||
completely raw and unchanged packets.
|
||||
completely raw and unchanged packets. Even worse, some drivers on some
|
||||
platforms might change the link-layer type field to whatever value
|
||||
libpcap used when attaching to the device, even on platforms that
|
||||
.I do
|
||||
nominally support sending completely raw and unchanged packets.
|
||||
.PP
|
||||
.B pcap_sendpacket()
|
||||
is like
|
||||
@ -783,23 +787,23 @@ has been made the filter program for a pcap structure by a call to
|
||||
.PP
|
||||
.B pcap_setdirection()
|
||||
is used to specify a direction that packets will be captured.
|
||||
.I direction_t
|
||||
.I pcap_direction_t
|
||||
is one of the constants
|
||||
.BR D_IN ,
|
||||
.B D_OUT
|
||||
.BR PCAP_D_IN ,
|
||||
.B PCAP_D_OUT
|
||||
or
|
||||
.BR D_INOUT .
|
||||
.B D_IN
|
||||
.BR PCAP_D_INOUT .
|
||||
.B PCAP_D_IN
|
||||
will only capture packets received by the device,
|
||||
.B D_OUT
|
||||
.B PCAP_D_OUT
|
||||
will only capture packets sent by the device and
|
||||
.B D_INOUT
|
||||
.B PCAP_D_INOUT
|
||||
will capture packets received by or sent by the device.
|
||||
.B D_INOUT
|
||||
.B PCAP_D_INOUT
|
||||
is the default setting if this function is not called. This isn't
|
||||
necessarily supported on all platforms; some platforms might return an
|
||||
error, and some other platforms might not support
|
||||
.BR D_OUT .
|
||||
.BR PCAP_D_OUT .
|
||||
This operation is not supported if a ``savefile'' is being read.
|
||||
.B \-1
|
||||
is returned on failure,
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52 2004/12/18 08:52:11 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52.2.5 2005/07/07 02:04:36 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_h
|
||||
@ -113,10 +113,10 @@ struct pcap_file_header {
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
D_INOUT = 0,
|
||||
D_IN,
|
||||
D_OUT
|
||||
} direction_t;
|
||||
PCAP_D_INOUT = 0,
|
||||
PCAP_D_IN,
|
||||
PCAP_D_OUT
|
||||
} pcap_direction_t;
|
||||
|
||||
/*
|
||||
* Each packet in the dump file is prepended with this generic header.
|
||||
@ -216,7 +216,7 @@ int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
|
||||
void pcap_breakloop(pcap_t *);
|
||||
int pcap_stats(pcap_t *, struct pcap_stat *);
|
||||
int pcap_setfilter(pcap_t *, struct bpf_program *);
|
||||
int pcap_setdirection(pcap_t *, direction_t);
|
||||
int pcap_setdirection(pcap_t *, pcap_direction_t);
|
||||
int pcap_getnonblock(pcap_t *, char *);
|
||||
int pcap_setnonblock(pcap_t *, int, char *);
|
||||
void pcap_perror(pcap_t *, char *);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.99.2.3 2005/06/20 21:30:19 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.99.2.4 2005/09/05 09:08:07 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -264,6 +264,8 @@ outbound return OUTBOUND;
|
||||
|
||||
vlan return VLAN;
|
||||
mpls return MPLS;
|
||||
pppoed return PPPOED;
|
||||
pppoes return PPPOES;
|
||||
|
||||
lane return LANE;
|
||||
llc return LLC;
|
||||
|
Loading…
x
Reference in New Issue
Block a user