Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/npf/npfctl npfctl: allow group of zeroes in IPv6 ad...



details:   https://anonhg.NetBSD.org/src/rev/69aa1afa91a2
branches:  trunk
changeset: 329641:69aa1afa91a2
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat May 31 22:37:05 2014 +0000

description:
npfctl: allow group of zeroes in IPv6 address; noted by spz@.

diffstat:

 usr.sbin/npf/npfctl/npf_scan.l |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 18ee53228937 -r 69aa1afa91a2 usr.sbin/npf/npfctl/npf_scan.l
--- a/usr.sbin/npf/npfctl/npf_scan.l    Sat May 31 20:26:51 2014 +0000
+++ b/usr.sbin/npf/npfctl/npf_scan.l    Sat May 31 22:37:05 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_scan.l,v 1.20 2014/03/14 11:29:45 rmind Exp $      */
+/*     $NetBSD: npf_scan.l,v 1.21 2014/05/31 22:37:05 rmind Exp $      */
 
 /*-
  * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@
 ID     [a-zA-Z_][a-zA-Z_0-9]*
 DID    [a-zA-Z_][a-zA-Z_0-9-]*
 NUMBER [0-9]+
+HEXDIG [0-9a-fA-F]+
 
 %%
 alg                    return ALG;
@@ -151,7 +152,7 @@
 ","                    return COMMA;
 "="                    return EQ;
 
-"0x"[0-9a-fA-F]+ {
+"0x"{HEXDIG} {
                        char *endp, *buf = ecalloc(1, yyleng + 1);
                        buf[yyleng] = 0;
                        yylval.num = strtoul(buf+2, &endp, 16);
@@ -166,7 +167,12 @@
                        return FPNUM;
                }
 
-[0-9a-fA-F]+":"[0-9a-fA-F:]* {
+{HEXDIG}":"[0-9a-fA-F:]* {
+                       yylval.str = estrndup(yytext, yyleng);
+                       return IPV6ADDR;
+               }
+
+"::"{HEXDIG}[0-9a-fA-F:]* {
                        yylval.str = estrndup(yytext, yyleng);
                        return IPV6ADDR;
                }



Home | Main Index | Thread Index | Old Index