summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2013-03-04 19:01:38 +0000
committermelifaro <melifaro@FreeBSD.org>2013-03-04 19:01:38 +0000
commit68eaa885cacec0b2c6ff1d1345f422b741060bca (patch)
tree087553c59092037e27cb0171cf87b1bd2585b7fc /sbin/ipfw
parenta46fb687f8ad27ff1856cbb9e63ffeedfe32a01e (diff)
downloadFreeBSD-src-68eaa885cacec0b2c6ff1d1345f422b741060bca.zip
FreeBSD-src-68eaa885cacec0b2c6ff1d1345f422b741060bca.tar.gz
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
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 5d79ece..ae5d2aa 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -3083,9 +3083,14 @@ chkarg:
} 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));
OpenPOWER on IntegriCloud