From Arien Vijn: support various notions for MAC addresses.
This commit is contained in:
parent
26504998e7
commit
f8f7ec5ace
1
CREDITS
1
CREDITS
|
@ -15,6 +15,7 @@ Additional people who have contributed patches:
|
|||
Albert Chin <china at thewrittenword dot com>
|
||||
Andrew Brown <atatat at atatdot dot net>
|
||||
Antti Kantee <pooka at netbsd dot org>
|
||||
Arien Vijn <arienvijn at sourceforge dot net>
|
||||
Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
|
||||
Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
|
||||
Assar Westerlund <assar at sics dot se>
|
||||
|
|
14
nametoaddr.c
14
nametoaddr.c
|
@ -24,7 +24,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.82 2007-06-11 10:04:25 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.83 2008-02-06 10:21:30 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -398,7 +398,15 @@ __pcap_atodn(const char *s, bpf_u_int32 *addr)
|
|||
}
|
||||
|
||||
/*
|
||||
* Convert 's' which has the form "xx:xx:xx:xx:xx:xx" into a new
|
||||
* Convert 's', which can have the one of the forms:
|
||||
*
|
||||
* "xx:xx:xx:xx:xx:xx"
|
||||
* "xx.xx.xx.xx.xx.xx"
|
||||
* "xx-xx-xx-xx-xx-xx"
|
||||
* "xxxx.xxxx.xxxx"
|
||||
* "xxxxxxxxxxxx"
|
||||
*
|
||||
* (or various mixes of ':', '.', and '-') into a new
|
||||
* ethernet address. Assumes 's' is well formed.
|
||||
*/
|
||||
u_char *
|
||||
|
@ -410,7 +418,7 @@ pcap_ether_aton(const char *s)
|
|||
e = ep = (u_char *)malloc(6);
|
||||
|
||||
while (*s) {
|
||||
if (*s == ':')
|
||||
if (*s == ':' || *s == '.' || *s == '-')
|
||||
s += 1;
|
||||
d = xdtoi(*s++);
|
||||
if (isxdigit((unsigned char)*s)) {
|
||||
|
|
11
scanner.l
11
scanner.l
|
@ -22,7 +22,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.111 2007-11-18 02:03:52 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.112 2008-02-06 10:21:30 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -79,6 +79,7 @@ extern YYSTYPE yylval;
|
|||
|
||||
N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
|
||||
B ([0-9A-Fa-f][0-9A-Fa-f]?)
|
||||
B2 ([0-9A-Fa-f][0-9A-Fa-f][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 18400
|
||||
|
@ -166,6 +167,10 @@ 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})
|
||||
|
||||
MAC ({B}:{B}:{B}:{B}:{B}:{B}|{B}\-{B}\-{B}\-{B}\-{B}\-{B}|{B}\.{B}\.{B}\.{B}\.{B}\.{B}|{B2}\.{B2}\.{B2}|{B2}{3})
|
||||
|
||||
|
||||
|
||||
%%
|
||||
dst return DST;
|
||||
src return SRC;
|
||||
|
@ -315,11 +320,11 @@ sls return SLS;
|
|||
">>" return RSH;
|
||||
${B} { yylval.e = pcap_ether_aton(((char *)yytext)+1);
|
||||
return AID; }
|
||||
{MAC} { yylval.e = pcap_ether_aton((char *)yytext);
|
||||
return EID; }
|
||||
{N} { yylval.i = stoi((char *)yytext); return NUM; }
|
||||
({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
|
||||
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;
|
||||
|
|
Reference in New Issue