From 5ab0e10fc6e2c22363ad4428f9aaf8965ee71d51 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 16 Aug 2016 18:07:21 +0200 Subject: src: support for RFC2732 IPv6 address format with brackets The statement: dnat to 2001:838:35f:1:::80 is very confusing as it is not so easy to identify where address ends and the port starts. This even harder to read with ranges. So this patch adds squared brackets as RFC2732 to enclose the IPv6 address. Signed-off-by: Pablo Neira Ayuso --- src/scanner.l | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/scanner.l') diff --git a/src/scanner.l b/src/scanner.l index 613c3c9e..3ad4dd9c 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -169,6 +169,7 @@ v60 (::) macaddr (([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}) ip4addr (([[:digit:]]{1,3}"."){3}([[:digit:]]{1,3})) ip6addr ({v680}|{v67}|{v66}|{v65}|{v64}|{v63}|{v62}|{v61}|{v60}) +ip6addr_rfc2732 (\[{ip6addr}\]) addrstring ({macaddr}|{ip4addr}|{ip6addr}) @@ -475,6 +476,12 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) return STRING; } +{ip6addr_rfc2732} { + yytext[yyleng - 1] = '\0'; + yylval->string = xstrdup(yytext + 1); + return STRING; + } + {timestring} { yylval->string = xstrdup(yytext); return STRING; -- cgit v1.2.3