ok?
Fix classless-{ms-,}static-routes to comply RFC 3442. Number of
octets should be changed by corresponding to the prefix length. And 0
should be allowed for the prefix length. Also fix white spaces.
Based on diff from Yuuichi Someya.
Index: usr.sbin/dhcpd/confpars.c
===================================================================
RCS file: /cvs/src/usr.sbin/dhcpd/confpars.c,v
retrieving revision 1.22
diff -u -p -r1.22 confpars.c
--- usr.sbin/dhcpd/confpars.c 21 Jan 2014 03:07:51 -0000 1.22
+++ usr.sbin/dhcpd/confpars.c 4 Jul 2014 01:21:18 -0000
@@ -823,7 +823,7 @@ void parse_group_declaration(cfile, grou
* bit-count :== 0..32
*/
int
-parse_cidr(FILE *cfile, unsigned char *addr, unsigned char *prefix)
+parse_cidr(FILE *cfile, unsigned char *addr, unsigned char *prefix)
{
char *val;
int token;
@@ -835,7 +835,7 @@ parse_cidr(FILE *cfile, unsigned char *a
parse_warn("Expecting CIDR subnet");
goto nocidr;
}
-
+
token = next_token(&val, cfile);
if (token != '/') {
parse_warn("Expecting '/'");
@@ -847,7 +847,7 @@ parse_cidr(FILE *cfile, unsigned char *a
if (token == TOK_NUMBER)
convert_num(prefix, val, 10, 8);
- if (token != TOK_NUMBER || *prefix < 1 || *prefix > 32) {
+ if (token != TOK_NUMBER || *prefix > 32) {
parse_warn("Expecting CIDR prefix length, got '%s'", val);
goto nocidr;
}
@@ -1156,8 +1156,9 @@ void parse_option_param(cfile, group)
return;
tree = tree_concat(tree, tree_const(&cprefix,
sizeof(cprefix)));
- tree = tree_concat(tree, tree_const(buf,
- sizeof(buf)));
+ if (cprefix > 0)
+ tree = tree_concat(tree, tree_const(buf,
+ cprefix / NBBY));
break;
default:
warning("Bad format %c in parse_option_param.",