Fri Jan 22 22:03:54 2016 UTC ()
handle v4 mapped addresses


(christos)
diff -r1.22 -r1.23 src/usr.sbin/npf/npfctl/npf_scan.l

cvs diff -r1.22 -r1.23 src/usr.sbin/npf/npfctl/npf_scan.l (expand / switch to unified diff)

--- src/usr.sbin/npf/npfctl/npf_scan.l 2014/12/26 22:44:54 1.22
+++ src/usr.sbin/npf/npfctl/npf_scan.l 2016/01/22 22:03:54 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: npf_scan.l,v 1.22 2014/12/26 22:44:54 christos Exp $ */ 1/* $NetBSD: npf_scan.l,v 1.23 2016/01/22 22:03:54 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011-2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Martin Husemann. 8 * by Martin Husemann.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -165,27 +165,27 @@ any return ANY; @@ -165,27 +165,27 @@ any return ANY;
165 165
166{NUMBER}"."{NUMBER} { 166{NUMBER}"."{NUMBER} {
167 char *endp, *buf = estrndup(yytext, yyleng); 167 char *endp, *buf = estrndup(yytext, yyleng);
168 yylval.fpnum = strtod(buf, &endp); 168 yylval.fpnum = strtod(buf, &endp);
169 free(buf); 169 free(buf);
170 return FPNUM; 170 return FPNUM;
171 } 171 }
172 172
173{HEXDIG}":"[0-9a-fA-F:]* { 173{HEXDIG}":"[0-9a-fA-F:]* {
174 yylval.str = estrndup(yytext, yyleng); 174 yylval.str = estrndup(yytext, yyleng);
175 return IPV6ADDR; 175 return IPV6ADDR;
176 } 176 }
177 177
178"::"{HEXDIG}[0-9a-fA-F:]* { 178"::"{HEXDIG}[0-9a-fA-F:.]* {
179 yylval.str = estrndup(yytext, yyleng); 179 yylval.str = estrndup(yytext, yyleng);
180 return IPV6ADDR; 180 return IPV6ADDR;
181 } 181 }
182 182
183{NUMBER}"."[0-9][0-9.]* { 183{NUMBER}"."[0-9][0-9.]* {
184 yylval.str = estrndup(yytext, yyleng); 184 yylval.str = estrndup(yytext, yyleng);
185 return IPV4ADDR; 185 return IPV4ADDR;
186 } 186 }
187 187
188{NUMBER} { 188{NUMBER} {
189 char *endp, *buf = estrndup(yytext, yyleng); 189 char *endp, *buf = estrndup(yytext, yyleng);
190 yylval.num = strtoul(buf, &endp, 10); 190 yylval.num = strtoul(buf, &endp, 10);
191 free(buf); 191 free(buf);