explicitly parse IPv6 address, to avoid conflict with "ip[2:2]" syntax.

This commit is contained in:
itojun 2000-04-14 14:25:40 +00:00
parent 1767c08cba
commit c43e0a1d53

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: scanner.l,v 1.9 1999/10/25 16:39:37 is Exp $ */
/* $NetBSD: scanner.l,v 1.10 2000/04/14 14:25:40 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@ -28,7 +28,7 @@
static const char rcsid[] =
"@(#) Header: scanner.l,v 1.56 97/07/21 13:31:50 leres Exp (LBL)";
#else
__RCSID("$NetBSD: scanner.l,v 1.9 1999/10/25 16:39:37 is Exp $");
__RCSID("$NetBSD: scanner.l,v 1.10 2000/04/14 14:25:40 itojun Exp $");
#endif
#endif
@ -92,6 +92,84 @@ W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?)
%a 3000
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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}:{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;
src return SRC;
@ -125,7 +203,13 @@ net return NET;
mask return MASK;
port return PORT;
proto return PROTO;
protochain return PROTOCHAIN;
protochain {
#ifdef NO_PROTOCHAIN
bpf_error("%s not supported", yytext);
#else
return PROTOCHAIN;
#endif
}
gateway return GATEWAY;
@ -158,7 +242,7 @@ 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; }
[0-9a-zA-Z:]*:[0-9a-zA-Z:]*(:{N}\.{N}\.{N}\.{N})? {
{V6} {
#ifdef INET6
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));