aboutsummaryrefslogtreecommitdiff
path: root/contrib/ipfilter
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ipfilter')
-rw-r--r--contrib/ipfilter/lib/familyname.c2
-rw-r--r--contrib/ipfilter/lib/printhashnode.c4
-rw-r--r--contrib/ipfilter/lib/printip.c2
-rw-r--r--contrib/ipfilter/lib/printpoolnode.c4
-rw-r--r--contrib/ipfilter/tools/ipf_y.y2
-rw-r--r--contrib/ipfilter/tools/ippool.c33
-rw-r--r--contrib/ipfilter/tools/ippool_y.y4
7 files changed, 34 insertions, 17 deletions
diff --git a/contrib/ipfilter/lib/familyname.c b/contrib/ipfilter/lib/familyname.c
index 35bb975cc6b1..891c6715ed0b 100644
--- a/contrib/ipfilter/lib/familyname.c
+++ b/contrib/ipfilter/lib/familyname.c
@@ -4,7 +4,7 @@ const char *familyname(int family)
{
if (family == AF_INET)
return "inet";
-#ifdef AF_INET6
+#ifdef USE_INET6
if (family == AF_INET6)
return "inet6";
#endif
diff --git a/contrib/ipfilter/lib/printhashnode.c b/contrib/ipfilter/lib/printhashnode.c
index 5f0f5f67938f..8a45d86c5134 100644
--- a/contrib/ipfilter/lib/printhashnode.c
+++ b/contrib/ipfilter/lib/printhashnode.c
@@ -35,7 +35,7 @@ printhashnode(iph, ipep, copyfunc, opts, fields)
}
printf("\n");
} else if ((opts & OPT_DEBUG) != 0) {
-#ifdef AF_INET6
+#ifdef USE_INET6
if (ipe.ipe_family == AF_INET6) {
char buf[INET6_ADDRSTRLEN + 1];
const char *str;
@@ -59,7 +59,7 @@ printhashnode(iph, ipep, copyfunc, opts, fields)
} else if (ipe.ipe_family == AF_INET) {
#else
if (ipe.ipe_family == AF_INET) {
-#endif /* AF_INET6 */
+#endif /* USE_INET6 */
PRINTF("\t%d\tAddress: %s", hv,
inet_ntoa(ipe.ipe_addr.in4));
printmask(ipe.ipe_family, (u_32_t *)&ipe.ipe_mask.in4_addr);
diff --git a/contrib/ipfilter/lib/printip.c b/contrib/ipfilter/lib/printip.c
index 6d414fe3fa41..a0b8bd37f277 100644
--- a/contrib/ipfilter/lib/printip.c
+++ b/contrib/ipfilter/lib/printip.c
@@ -25,7 +25,7 @@ printip(family, addr)
else
PRINTF("%s", inet_ntoa(ipa));
}
-#ifdef AF_INET6
+#ifdef USE_INET6
else if (family == AF_INET6) {
char buf[INET6_ADDRSTRLEN + 1];
const char *str;
diff --git a/contrib/ipfilter/lib/printpoolnode.c b/contrib/ipfilter/lib/printpoolnode.c
index 59e09228f05e..6b58b8459327 100644
--- a/contrib/ipfilter/lib/printpoolnode.c
+++ b/contrib/ipfilter/lib/printpoolnode.c
@@ -33,7 +33,7 @@ printpoolnode(np, opts, fields)
printmask(np->ipn_addr.adf_family,
(u_32_t *)&np->ipn_mask.adf_addr);
} else {
-#ifdef AF_INET6
+#ifdef USE_INET6
if (np->ipn_addr.adf_family == AF_INET6) {
char buf[INET6_ADDRSTRLEN + 1];
const char *str;
@@ -54,9 +54,7 @@ printpoolnode(np, opts, fields)
} else {
PRINTF("\tAddress: family: %d\n",
np->ipn_addr.adf_family);
-#ifdef AF_INET6
}
-#endif
printmask(np->ipn_addr.adf_family,
(u_32_t *)&np->ipn_mask.adf_addr);
#ifdef USE_QUAD_T
diff --git a/contrib/ipfilter/tools/ipf_y.y b/contrib/ipfilter/tools/ipf_y.y
index 26db2a22e45e..2240a2a1c21f 100644
--- a/contrib/ipfilter/tools/ipf_y.y
+++ b/contrib/ipfilter/tools/ipf_y.y
@@ -2303,7 +2303,7 @@ makepool(list)
for (n = top, a = list; (n != NULL) && (a != NULL); a = a->al_next) {
if (use_inet6 == 1) {
-#ifdef AF_INET6
+#ifdef USE_INET6
n->ipn_addr.adf_family = AF_INET6;
n->ipn_addr.adf_addr = a->al_i6addr;
n->ipn_addr.adf_len = offsetof(addrfamily_t,
diff --git a/contrib/ipfilter/tools/ippool.c b/contrib/ipfilter/tools/ippool.c
index e204b0074098..c8a9c70b136e 100644
--- a/contrib/ipfilter/tools/ippool.c
+++ b/contrib/ipfilter/tools/ippool.c
@@ -201,17 +201,27 @@ poolnodecommand(remove, argc, argv)
}
break;
case 'T' :
- ttl = atoi(optarg);
- if (ttl < 0) {
- fprintf(stderr, "cannot set negative ttl\n");
- return -1;
+ if (remove == 0) {
+ ttl = atoi(optarg);
+ if (ttl < 0) {
+ fprintf(stderr, "cannot set negative ttl\n");
+ return -1;
+ }
+ } else {
+ usage(argv[0]);
}
break;
case 'v' :
opts |= OPT_VERBOSE;
break;
+ default :
+ usage(argv[0]);
+ break; /* keep compiler happy */
}
+ if (argc - 1 - optind > 0)
+ usage(argv[0]);
+
if (argv[optind] != NULL && ipset == 0) {
if (setnodeaddr(type, role, ptr, argv[optind]) == 0)
ipset = 1;
@@ -268,7 +278,7 @@ poolcommand(remove, argc, argv)
bzero((char *)&iph, sizeof(iph));
bzero((char *)&pool, sizeof(pool));
- while ((c = getopt(argc, argv, "dm:no:RSv")) != -1)
+ while ((c = getopt(argc, argv, "dm:no:RS:v")) != -1)
switch (c)
{
case 'd' :
@@ -292,13 +302,22 @@ poolcommand(remove, argc, argv)
opts |= OPT_NORESOLVE;
break;
case 'S' :
- iph.iph_seed = atoi(optarg);
+ if (remove == 0)
+ iph.iph_seed = atoi(optarg);
+ else
+ usage(argv[0]);
break;
case 'v' :
opts |= OPT_VERBOSE;
break;
+ default :
+ usage(argv[0]);
+ break; /* keep compiler happy */
}
+ if (argc - 1 - optind > 0)
+ usage(argv[0]);
+
if (opts & OPT_DEBUG)
fprintf(stderr, "poolcommand: opts = %#x\n", opts);
@@ -568,7 +587,7 @@ poolflush(argc, argv)
break; /* keep compiler happy */
}
- if (argc - 1 - optind > 0)
+ if (argc - optind > 0)
usage(argv[0]);
if (opts & OPT_DEBUG)
diff --git a/contrib/ipfilter/tools/ippool_y.y b/contrib/ipfilter/tools/ippool_y.y
index 93593ce82eca..2c7574f9432d 100644
--- a/contrib/ipfilter/tools/ippool_y.y
+++ b/contrib/ipfilter/tools/ippool_y.y
@@ -273,7 +273,7 @@ grouplist:
| addrmask next { $$ = calloc(1, sizeof(iphtent_t));
$$->ipe_addr = $1[0].adf_addr;
$$->ipe_mask = $1[1].adf_addr;
-#ifdef AF_INET6
+#ifdef USE_INET6
if (use_inet6)
$$->ipe_family = AF_INET6;
else
@@ -297,7 +297,7 @@ groupentry:
$$->ipe_mask = $1[1].adf_addr;
strncpy($$->ipe_group, $3,
FR_GROUPLEN);
-#ifdef AF_INET6
+#ifdef USE_INET6
if (use_inet6)
$$->ipe_family = AF_INET6;
else