mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-29 13:15:05 +00:00
Merge libpcap 0.5
This commit is contained in:
parent
d52656061b
commit
fae05455f6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56891
|
@ -37,7 +37,8 @@
|
|||
*
|
||||
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf.h,v 1.37 1999/10/19 15:18:31 itojun Exp $ (LBL)
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef BPF_MAJOR_VERSION
|
||||
|
@ -52,11 +53,7 @@ typedef u_int bpf_u_int32;
|
|||
* Alignment macros. BPF_WORDALIGN rounds up to the next
|
||||
* even multiple of BPF_ALIGNMENT.
|
||||
*/
|
||||
#ifndef __NetBSD__
|
||||
#define BPF_ALIGNMENT sizeof(bpf_int32)
|
||||
#else
|
||||
#define BPF_ALIGNMENT sizeof(long)
|
||||
#endif
|
||||
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
|
||||
|
||||
#define BPF_MAXINSNS 512
|
||||
|
@ -172,21 +169,10 @@ struct bpf_hdr {
|
|||
#define DLT_SLIP 8 /* Serial Line IP */
|
||||
#define DLT_PPP 9 /* Point-to-point Protocol */
|
||||
#define DLT_FDDI 10 /* FDDI */
|
||||
#ifdef __FreeBSD__
|
||||
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
|
||||
#define DLT_LOOP 12 /* loopback */
|
||||
#endif
|
||||
/* offset to avoid collision with BSD/OS values */
|
||||
#ifndef DLT_ATM_RFC1483
|
||||
#define DLT_ATM_RFC1483 100 /* LLC/SNAP encapsulated atm */
|
||||
#endif
|
||||
#define DLT_RAW 101 /* raw IP */
|
||||
#define DLT_SLIP_BSDOS 102 /* BSD/OS Serial Line IP */
|
||||
#define DLT_PPP_BSDOS 103 /* BSD/OS Point-to-point Protocol */
|
||||
#define DLT_CHDLC 104 /* Cisco HDLC */
|
||||
#define DLT_RAW 12 /* raw IP */
|
||||
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
|
||||
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
|
||||
|
||||
/*
|
||||
* The instruction encondings.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,7 +18,8 @@
|
|||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: gencode.h,v 1.36 96/07/17 00:11:34 leres Exp $ (LBL)
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.37 1999/10/19 15:18:29 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*XXX*/
|
||||
|
@ -31,6 +32,7 @@
|
|||
#define Q_PORT 3
|
||||
#define Q_GATEWAY 4
|
||||
#define Q_PROTO 5
|
||||
#define Q_PROTOCHAIN 6
|
||||
|
||||
/* Protocol qualifiers. */
|
||||
|
||||
|
@ -51,9 +53,17 @@
|
|||
#define Q_SCA 13
|
||||
#define Q_MOPRC 14
|
||||
#define Q_MOPDL 15
|
||||
#define Q_ISO 16
|
||||
#define Q_ESIS 17
|
||||
#define Q_ISIS 18
|
||||
|
||||
#define Q_IPV6 16
|
||||
#define Q_ICMPV6 17
|
||||
#define Q_AH 18
|
||||
#define Q_ESP 19
|
||||
|
||||
#define Q_PIM 20
|
||||
|
||||
#define Q_ISO 21
|
||||
#define Q_ESIS 22
|
||||
#define Q_ISIS 23
|
||||
|
||||
/* Directional qualifiers. */
|
||||
|
||||
|
@ -65,8 +75,12 @@
|
|||
#define Q_DEFAULT 0
|
||||
#define Q_UNDEF 255
|
||||
|
||||
struct slist;
|
||||
|
||||
struct stmt {
|
||||
int code;
|
||||
struct slist *jt; /*only for relative jump in block*/
|
||||
struct slist *jf; /*only for relative jump in block*/
|
||||
bpf_int32 k;
|
||||
};
|
||||
|
||||
|
@ -153,6 +167,9 @@ void gen_not(struct block *);
|
|||
struct block *gen_scode(const char *, struct qual);
|
||||
struct block *gen_ecode(const u_char *, struct qual);
|
||||
struct block *gen_mcode(const char *, const char *, int, struct qual);
|
||||
#ifdef INET6
|
||||
struct block *gen_mcode6(const char *, const char *, int, struct qual);
|
||||
#endif
|
||||
struct block *gen_ncode(const char *, bpf_u_int32, struct qual);
|
||||
struct block *gen_proto_abbrev(int);
|
||||
struct block *gen_relation(int, struct arth *, struct arth *, int);
|
||||
|
@ -180,3 +197,5 @@ void sappend(struct slist *, struct slist *);
|
|||
/* XXX */
|
||||
#define JT(b) ((b)->et.succ)
|
||||
#define JF(b) ((b)->ef.succ)
|
||||
|
||||
extern int no_optimize;
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: grammar.y,v 1.56 96/11/02 21:54:55 leres Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.57 1999/10/19 15:18:30 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -102,21 +103,22 @@ pcap_parse()
|
|||
%type <rblk> other
|
||||
|
||||
%token DST SRC HOST GATEWAY
|
||||
%token NET MASK PORT LESS GREATER PROTO BYTE
|
||||
%token ARP RARP IP TCP UDP ICMP IGMP IGRP
|
||||
%token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE
|
||||
%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM
|
||||
%token ATALK DECNET LAT SCA MOPRC MOPDL
|
||||
%token TK_BROADCAST TK_MULTICAST
|
||||
%token NUM INBOUND OUTBOUND
|
||||
%token LINK
|
||||
%token GEQ LEQ NEQ
|
||||
%token ID EID HID
|
||||
%token ID EID HID HID6
|
||||
%token LSH RSH
|
||||
%token LEN
|
||||
%token ISO ESIS ISIS
|
||||
%token IPV6 ICMPV6 AH ESP
|
||||
|
||||
%type <s> ID
|
||||
%type <e> EID
|
||||
%type <s> HID
|
||||
%type <s> HID HID6
|
||||
%type <i> NUM
|
||||
|
||||
%left OR AND
|
||||
|
@ -168,6 +170,24 @@ nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); }
|
|||
break;
|
||||
}
|
||||
}
|
||||
| HID6 '/' NUM {
|
||||
#ifdef INET6
|
||||
$$.b = gen_mcode6($1, NULL, $3,
|
||||
$$.q = $<blk>0.q);
|
||||
#else
|
||||
bpf_error("'ip6addr/prefixlen' not supported "
|
||||
"in this configuration");
|
||||
#endif /*INET6*/
|
||||
}
|
||||
| HID6 {
|
||||
#ifdef INET6
|
||||
$$.b = gen_mcode6($1, 0, 128,
|
||||
$$.q = $<blk>0.q);
|
||||
#else
|
||||
bpf_error("'ip6addr' not supported "
|
||||
"in this configuration");
|
||||
#endif /*INET6*/
|
||||
}
|
||||
| EID { $$.b = gen_ecode($1, $$.q = $<blk>0.q); }
|
||||
| not id { gen_not($2.b); $$ = $2; }
|
||||
;
|
||||
|
@ -190,6 +210,7 @@ head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
|
|||
| pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
|
||||
| pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
|
||||
| pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
|
||||
| pqual PROTOCHAIN { QSET($$.q, $1, Q_DEFAULT, Q_PROTOCHAIN); }
|
||||
| pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
|
||||
;
|
||||
rterm: head id { $$ = $2; }
|
||||
|
@ -230,12 +251,17 @@ pname: LINK { $$ = Q_LINK; }
|
|||
| ICMP { $$ = Q_ICMP; }
|
||||
| IGMP { $$ = Q_IGMP; }
|
||||
| IGRP { $$ = Q_IGRP; }
|
||||
| PIM { $$ = Q_PIM; }
|
||||
| ATALK { $$ = Q_ATALK; }
|
||||
| DECNET { $$ = Q_DECNET; }
|
||||
| LAT { $$ = Q_LAT; }
|
||||
| SCA { $$ = Q_SCA; }
|
||||
| MOPDL { $$ = Q_MOPDL; }
|
||||
| MOPRC { $$ = Q_MOPRC; }
|
||||
| IPV6 { $$ = Q_IPV6; }
|
||||
| ICMPV6 { $$ = Q_ICMPV6; }
|
||||
| AH { $$ = Q_AH; }
|
||||
| ESP { $$ = Q_ESP; }
|
||||
| ISO { $$ = Q_ISO; }
|
||||
| ESIS { $$ = Q_ESIS; }
|
||||
| ISIS { $$ = Q_ISIS; }
|
||||
|
|
|
@ -20,11 +20,13 @@
|
|||
*
|
||||
* Name to id translation routines used by the scanner.
|
||||
* These functions are not time critical.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: nametoaddr.c,v 1.48 98/07/12 13:15:36 leres Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.51 1999/11/25 08:25:35 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -41,6 +43,10 @@ struct rtentry;
|
|||
#include <net/ethernet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifdef INET6
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#endif /*INET6*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -70,6 +76,7 @@ static inline int xdtoi(int);
|
|||
* Convert host name to internet address.
|
||||
* Return 0 upon failure.
|
||||
*/
|
||||
#ifndef INET6
|
||||
bpf_u_int32 **
|
||||
pcap_nametoaddr(const char *name)
|
||||
{
|
||||
|
@ -93,6 +100,23 @@ pcap_nametoaddr(const char *name)
|
|||
else
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
struct addrinfo *
|
||||
pcap_nametoaddr(const char *name)
|
||||
{
|
||||
struct addrinfo hints, *res;
|
||||
int error;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM; /*not really*/
|
||||
error = getaddrinfo(name, NULL, &hints, &res);
|
||||
if (error)
|
||||
return NULL;
|
||||
else
|
||||
return res;
|
||||
}
|
||||
#endif /*INET6*/
|
||||
|
||||
/*
|
||||
* Convert net name to internet address.
|
||||
|
@ -182,9 +206,21 @@ struct eproto {
|
|||
|
||||
/* Static data base of ether protocol types. */
|
||||
struct eproto eproto_db[] = {
|
||||
#if 0
|
||||
/* The FreeBSD elf linker generates a request to copy this array
|
||||
* (including its size) when you link with -lpcap. In order to
|
||||
* not bump the major version number of this libpcap.so, we need
|
||||
* to ensure that the array stays the same size. Since PUP is
|
||||
* likely never seen in real life any more, it's the first to
|
||||
* be sacrificed (in favor of ip6).
|
||||
*/
|
||||
{ "pup", ETHERTYPE_PUP },
|
||||
#endif
|
||||
{ "xns", ETHERTYPE_NS },
|
||||
{ "ip", ETHERTYPE_IP },
|
||||
#ifdef INET6
|
||||
{ "ip6", ETHERTYPE_IPV6 },
|
||||
#endif
|
||||
{ "arp", ETHERTYPE_ARP },
|
||||
{ "rarp", ETHERTYPE_REVARP },
|
||||
{ "sprite", ETHERTYPE_SPRITE },
|
||||
|
@ -330,7 +366,7 @@ pcap_ether_hostton(const char *name)
|
|||
}
|
||||
#else
|
||||
|
||||
#ifndef sgi
|
||||
#if !defined(sgi) && !defined(__NetBSD__)
|
||||
extern int ether_hostton(char *, struct ether_addr *);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header: pcap-int.h,v 1.18 96/11/27 18:43:09 leres Exp $ (LBL)
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.20 1999/11/21 01:10:20 assar Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef pcap_int_h
|
||||
|
@ -101,6 +102,27 @@ struct pcap {
|
|||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a timeval as stored in disk in a dumpfile.
|
||||
* It has to use the same types everywhere, independent of the actual
|
||||
* `struct timeval'
|
||||
*/
|
||||
|
||||
struct pcap_timeval {
|
||||
bpf_int32 tv_sec; /* seconds */
|
||||
bpf_int32 tv_usec; /* microseconds */
|
||||
};
|
||||
|
||||
/*
|
||||
* How a `pcap_pkthdr' is actually stored in the dumpfile.
|
||||
*/
|
||||
|
||||
struct pcap_sf_pkthdr {
|
||||
struct pcap_timeval ts; /* time stamp */
|
||||
bpf_u_int32 caplen; /* length of portion present */
|
||||
bpf_u_int32 len; /* length this packet (off wire) */
|
||||
};
|
||||
|
||||
int yylex(void);
|
||||
|
||||
#ifndef min
|
||||
|
@ -112,7 +134,7 @@ int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *);
|
|||
int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *);
|
||||
|
||||
/* Ultrix pads to make everything line up on a nice boundary */
|
||||
#if defined(ultrix) || defined(__alpha)
|
||||
#if defined(ultrix) || defined(__alpha) || defined(__NetBSD__)
|
||||
#define PCAP_FDDIPAD 3
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header: pcap-namedb.h,v 1.5 96/07/14 03:00:14 leres Exp $ (LBL)
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.6 1999/10/19 15:18:31 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_ethers_h
|
||||
|
@ -59,7 +60,11 @@ struct pcap_etherent *pcap_next_etherent(FILE *);
|
|||
u_char *pcap_ether_hostton(const char*);
|
||||
u_char *pcap_ether_aton(const char *);
|
||||
|
||||
#ifndef INET6
|
||||
bpf_u_int32 **pcap_nametoaddr(const char *);
|
||||
#else
|
||||
struct addrinfo *pcap_nametoaddr(const char *);
|
||||
#endif
|
||||
bpf_u_int32 pcap_nametonetaddr(const char *);
|
||||
|
||||
int pcap_nametoport(const char *, int *, int *);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH PCAP 3 "24 June 1998"
|
||||
|
@ -227,6 +228,15 @@ controls whether optimization on the resulting code is performed.
|
|||
.I netmask
|
||||
specifies the netmask of the local net.
|
||||
.PP
|
||||
.B pcap_compile_nopcap()
|
||||
is similar to
|
||||
.B pcap_compile()
|
||||
except that instead of passing a pcap structure, one passes the
|
||||
snaplen and linktype explicitly. It is intended to be used for
|
||||
compiling filters for direct bpf usage, without necessarily having
|
||||
called
|
||||
.BR pcap_open() .
|
||||
.PP
|
||||
.B pcap_setfilter()
|
||||
is used to specify a filter program.
|
||||
.I fp
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header: pcap.h,v 1.21 97/10/15 21:59:13 leres Exp $ (LBL)
|
||||
* $FreeBSD$
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.22 1999/12/08 19:54:03 mcr Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_h
|
||||
|
@ -120,6 +121,8 @@ char *pcap_strerror(int);
|
|||
char *pcap_geterr(pcap_t *);
|
||||
int pcap_compile(pcap_t *, struct bpf_program *, char *, int,
|
||||
bpf_u_int32);
|
||||
int pcap_compile_nopcap(int, int, struct bpf_program *,
|
||||
char *, int, bpf_u_int32);
|
||||
/* XXX */
|
||||
int pcap_freecode(pcap_t *, struct bpf_program *);
|
||||
int pcap_datalink(pcap_t *);
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: scanner.l,v 1.56 97/07/21 13:31:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.60 1999/11/17 04:09:58 assar Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -30,11 +32,16 @@ static const char rcsid[] =
|
|||
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pcap-int.h"
|
||||
|
||||
#include "gencode.h"
|
||||
#include <pcap-namedb.h>
|
||||
#ifdef INET6
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#endif /*INET6*/
|
||||
#include "tokdefs.h"
|
||||
|
||||
#include "gnuc.h"
|
||||
|
@ -76,8 +83,91 @@ static char *in_buffer;
|
|||
|
||||
N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
|
||||
B ([0-9A-Fa-f][0-9A-Fa-f]?)
|
||||
W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?)
|
||||
|
||||
%a 3000
|
||||
%a 15000
|
||||
%o 17000
|
||||
%e 6000
|
||||
%k 4000
|
||||
%p 19000
|
||||
|
||||
V680 {W}:{W}:{W}:{W}:{W}:{W}:{W}:{W}
|
||||
|
||||
V670 ::{W}:{W}:{W}:{W}:{W}:{W}:{W}
|
||||
V671 {W}::{W}:{W}:{W}:{W}:{W}:{W}
|
||||
V672 {W}:{W}::{W}:{W}:{W}:{W}:{W}
|
||||
V673 {W}:{W}:{W}::{W}:{W}:{W}:{W}
|
||||
V674 {W}:{W}:{W}:{W}::{W}:{W}:{W}
|
||||
V675 {W}:{W}:{W}:{W}:{W}::{W}:{W}
|
||||
V676 {W}:{W}:{W}:{W}:{W}:{W}::{W}
|
||||
V677 {W}:{W}:{W}:{W}:{W}:{W}:{W}::
|
||||
|
||||
V660 ::{W}:{W}:{W}:{W}:{W}:{W}
|
||||
V661 {W}::{W}:{W}:{W}:{W}:{W}
|
||||
V662 {W}:{W}::{W}:{W}:{W}:{W}
|
||||
V663 {W}:{W}:{W}::{W}:{W}:{W}
|
||||
V664 {W}:{W}:{W}:{W}::{W}:{W}
|
||||
V665 {W}:{W}:{W}:{W}:{W}::{W}
|
||||
V666 {W}:{W}:{W}:{W}:{W}:{W}::
|
||||
|
||||
V650 ::{W}:{W}:{W}:{W}:{W}
|
||||
V651 {W}::{W}:{W}:{W}:{W}
|
||||
V652 {W}:{W}::{W}:{W}:{W}
|
||||
V653 {W}:{W}:{W}::{W}:{W}
|
||||
V654 {W}:{W}:{W}:{W}::{W}
|
||||
V655 {W}:{W}:{W}:{W}:{W}::
|
||||
|
||||
V640 ::{W}:{W}:{W}:{W}
|
||||
V641 {W}::{W}:{W}:{W}
|
||||
V642 {W}:{W}::{W}:{W}
|
||||
V643 {W}:{W}:{W}::{W}
|
||||
V644 {W}:{W}:{W}:{W}::
|
||||
|
||||
V630 ::{W}:{W}:{W}
|
||||
V631 {W}::{W}:{W}
|
||||
V632 {W}:{W}::{W}
|
||||
V633 {W}:{W}:{W}::
|
||||
|
||||
V620 ::{W}:{W}
|
||||
V621 {W}::{W}
|
||||
V622 {W}:{W}::
|
||||
|
||||
V610 ::{W}
|
||||
V611 {W}::
|
||||
|
||||
V600 ::
|
||||
|
||||
V6604 {W}:{W}:{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6504 ::{W}:{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6514 {W}::{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6524 {W}:{W}::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6534 {W}:{W}:{W}::{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6544 {W}:{W}:{W}:{W}::{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6554 {W}:{W}:{W}:{W}:{W}::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6404 ::{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6414 {W}::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6424 {W}:{W}::{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6434 {W}:{W}:{W}::{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6444 {W}:{W}:{W}:{W}::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6304 ::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6314 {W}::{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6324 {W}:{W}::{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6334 {W}:{W}:{W}::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6204 ::{W}:{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6214 {W}::{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6224 {W}:{W}::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6104 ::{W}:{N}\.{N}\.{N}\.{N}
|
||||
V6114 {W}::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
V6004 ::{N}\.{N}\.{N}\.{N}
|
||||
|
||||
|
||||
V6 ({V680}|{V670}|{V671}|{V672}|{V673}|{V674}|{V675}|{V676}|{V677}|{V660}|{V661}|{V662}|{V663}|{V664}|{V665}|{V666}|{V650}|{V651}|{V652}|{V653}|{V654}|{V655}|{V640}|{V641}|{V642}|{V643}|{V644}|{V630}|{V631}|{V632}|{V633}|{V620}|{V621}|{V622}|{V610}|{V611}|{V600}|{V6604}|{V6504}|{V6514}|{V6524}|{V6534}|{V6544}|{V6554}|{V6404}|{V6414}|{V6424}|{V6434}|{V6444}|{V6304}|{V6314}|{V6324}|{V6334}|{V6204}|{V6214}|{V6224}|{V6104}|{V6114}|{V6004})
|
||||
|
||||
%%
|
||||
dst return DST;
|
||||
|
@ -93,6 +183,12 @@ udp return UDP;
|
|||
icmp return ICMP;
|
||||
igmp return IGMP;
|
||||
igrp return IGRP;
|
||||
pim return PIM;
|
||||
|
||||
ip6 return IPV6;
|
||||
icmp6 return ICMPV6;
|
||||
ah return AH;
|
||||
esp return ESP;
|
||||
|
||||
atalk return ATALK;
|
||||
decnet return DECNET;
|
||||
|
@ -112,6 +208,13 @@ net return NET;
|
|||
mask return MASK;
|
||||
port return PORT;
|
||||
proto return PROTO;
|
||||
protochain {
|
||||
#ifdef NO_PROTOCHAIN
|
||||
bpf_error("%s not supported", yytext);
|
||||
#else
|
||||
return PROTOCHAIN;
|
||||
#endif
|
||||
}
|
||||
|
||||
gateway return GATEWAY;
|
||||
|
||||
|
@ -142,6 +245,21 @@ outbound return OUTBOUND;
|
|||
yylval.s = sdup((char *)yytext); return HID; }
|
||||
{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
|
||||
return EID; }
|
||||
{V6} {
|
||||
#ifdef INET6
|
||||
struct addrinfo hints, *res;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
if (getaddrinfo(yytext, NULL, &hints, &res))
|
||||
bpf_error("bogus IPv6 address %s", yytext);
|
||||
else {
|
||||
yylval.e = sdup((char *)yytext); return HID6;
|
||||
}
|
||||
#else
|
||||
bpf_error("IPv6 address %s not supported", yytext);
|
||||
#endif /*INET6*/
|
||||
}
|
||||
{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
|
||||
[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] {
|
||||
yylval.s = sdup((char *)yytext); return ID; }
|
||||
|
|
Loading…
Reference in a new issue