Do not suddenly fail on some rulesets if -n (syntax check only) is specified

and ipfw(4) module is not loaded.

MFC after:	2 weeks
This commit is contained in:
melifaro 2013-03-04 19:01:38 +00:00
parent a46fb687f8
commit 68eaa885ca

View File

@ -3083,9 +3083,14 @@ ipfw_add(char *av[])
} else {
len = sizeof(c->max_log);
if (sysctlbyname("net.inet.ip.fw.verbose_limit",
&c->max_log, &len, NULL, 0) == -1)
&c->max_log, &len, NULL, 0) == -1) {
if (co.test_only) {
c->max_log = 0;
break;
}
errx(1, "sysctlbyname(\"%s\")",
"net.inet.ip.fw.verbose_limit");
}
}
}
break;
@ -3986,9 +3991,13 @@ ipfw_table_handler(int ac, char *av[])
mask = 0; // XXX uninitialized ?
len = sizeof(tables_max);
if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len,
NULL, 0) == -1)
errx(1, "Can't determine maximum number of ipfw tables. "
"Perhaps you forgot to load ipfw module?");
NULL, 0) == -1) {
if (co.test_only)
tables_max = 128; /* Old conservative default */
else
errx(1, "Can't determine maximum number of ipfw tables."
" Perhaps you forgot to load ipfw module?");
}
memset(&xent, 0, sizeof(xent));