aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipf/ippool
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2021-12-22 02:37:19 +0000
committerCy Schubert <cy@FreeBSD.org>2022-01-04 02:06:43 +0000
commit2582ae5740181e0d2bab10003d66ae91c9b56329 (patch)
treeff4e38d374b18d43a59dd8a150ca3f4b04b8ae11 /sbin/ipf/ippool
parent8c82b37461fa4e60276639df214100fbf559ea6e (diff)
downloadsrc-2582ae5740181e0d2bab10003d66ae91c9b56329.tar.gz
src-2582ae5740181e0d2bab10003d66ae91c9b56329.zip
ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9). MFC after: 1 month
Diffstat (limited to 'sbin/ipf/ippool')
-rw-r--r--sbin/ipf/ippool/ippool.c62
-rw-r--r--sbin/ipf/ippool/ippool_y.y28
2 files changed, 45 insertions, 45 deletions
diff --git a/sbin/ipf/ippool/ippool.c b/sbin/ipf/ippool/ippool.c
index b339c617c3de..d5e090759057 100644
--- a/sbin/ipf/ippool/ippool.c
+++ b/sbin/ipf/ippool/ippool.c
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
if (err != 0)
exit(1);
- return 0;
+ return(0);
}
@@ -161,23 +161,23 @@ poolnodecommand(int remove, int argc, char *argv[])
if (ipset == 1) {
fprintf(stderr,
"cannot set role after ip address\n");
- return -1;
+ return(-1);
}
role = getrole(optarg);
if (role == IPL_LOGNONE)
- return -1;
+ return(-1);
break;
case 't' :
if (ipset == 1) {
fprintf(stderr,
"cannot set type after ip address\n");
- return -1;
+ return(-1);
}
type = gettype(optarg, NULL);
switch (type) {
case IPLT_NONE :
fprintf(stderr, "unknown type '%s'\n", optarg);
- return -1;
+ return(-1);
case IPLT_HASH :
ptr = &hnode;
break;
@@ -191,7 +191,7 @@ poolnodecommand(int remove, int argc, char *argv[])
ttl = atoi(optarg);
if (ttl < 0) {
fprintf(stderr, "cannot set negative ttl\n");
- return -1;
+ return(-1);
}
} else {
usage(argv[0]);
@@ -218,12 +218,12 @@ poolnodecommand(int remove, int argc, char *argv[])
if (ipset == 0) {
fprintf(stderr, "no IP address given with -i\n");
- return -1;
+ return(-1);
}
if (poolname == NULL) {
fprintf(stderr, "poolname not given with add/remove node\n");
- return -1;
+ return(-1);
}
switch (type) {
@@ -242,7 +242,7 @@ poolnodecommand(int remove, int argc, char *argv[])
default :
break;
}
- return err;
+ return(err);
}
@@ -279,7 +279,7 @@ poolcommand(int remove, int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
case 'S' :
@@ -308,7 +308,7 @@ poolcommand(int remove, int argc, char *argv[])
if (poolname == NULL) {
fprintf(stderr, "poolname not given with add/remove pool\n");
- return -1;
+ return(-1);
}
if (type == IPLT_NONE && remove == 0) {
@@ -318,7 +318,7 @@ poolcommand(int remove, int argc, char *argv[])
} else {
fprintf(stderr, "unknown type '%s'\n", typearg);
}
- return -1;
+ return(-1);
}
if (type == IPLT_HASH || (type == IPLT_NONE && remove == 1)) {
@@ -363,7 +363,7 @@ poolcommand(int remove, int argc, char *argv[])
break;
}
}
- return err;
+ return(err);
}
@@ -412,8 +412,8 @@ loadpoolfile(int argc, char *argv[], char *infile)
}
if (ippool_parsefile(fd, infile, ioctl) != 0)
- return -1;
- return 0;
+ return(-1);
+ return(0);
}
@@ -441,7 +441,7 @@ poolstats(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
case 't' :
@@ -449,7 +449,7 @@ poolstats(int argc, char *argv[])
if (type != IPLT_POOL) {
fprintf(stderr,
"-s not supported for this type yet\n");
- return -1;
+ return(-1);
}
break;
case 'v' :
@@ -482,7 +482,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(S0IOCLOOKUPSTAT)");
- return -1;
+ return(-1);
}
printf("%lu\taddress pools\n", plstat.ipls_pools);
printf("%lu\taddress pool nodes\n", plstat.ipls_nodes);
@@ -497,7 +497,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(SIOCLOOKUPSTAT)");
- return -1;
+ return(-1);
}
printf("%lu\thash tables\n", htstat.iphs_numtables);
printf("%lu\thash table nodes\n", htstat.iphs_numnodes);
@@ -514,7 +514,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(SIOCLOOKUPSTAT)");
- return -1;
+ return(-1);
}
printf("%u\tdestination lists\n",
dlstat.ipls_numlists);
@@ -528,7 +528,7 @@ poolstats(int argc, char *argv[])
dlstat.ipls_numderefnodes);
}
}
- return 0;
+ return(0);
}
@@ -552,14 +552,14 @@ poolflush(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
case 't' :
type = gettype(optarg, NULL);
if (type == IPLT_NONE) {
fprintf(stderr, "unknown type '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
case 'v' :
@@ -599,7 +599,7 @@ poolflush(int argc, char *argv[])
printf("%u object%s flushed\n", flush.iplf_count,
(flush.iplf_count == 1) ? "" : "s");
- return 0;
+ return(0);
}
@@ -630,7 +630,7 @@ getrole(char *rolename)
role = IPL_LOGNONE;
}
- return role;
+ return(role);
}
@@ -652,7 +652,7 @@ gettype(char *typename, u_int *minor)
} else {
type = IPLT_NONE;
}
- return type;
+ return(type);
}
@@ -691,7 +691,7 @@ poollist(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
#if 0
@@ -708,7 +708,7 @@ poollist(int argc, char *argv[])
type = gettype(optarg, NULL);
if (type == IPLT_NONE) {
fprintf(stderr, "unknown type '%s'\n", optarg);
- return -1;
+ return(-1);
}
break;
case 'v' :
@@ -744,7 +744,7 @@ poollist(int argc, char *argv[])
poollist_live(role, poolname, type, fd);
else
poollist_dead(role, poolname, type, kernel, core);
- return 0;
+ return(0);
}
@@ -1044,7 +1044,7 @@ setnodeaddr(int type, int role, void *ptr, char *arg)
mask.s_addr = 0xffffffff;
else if (strchr(s, '.') == NULL) {
if (ntomask(AF_INET, atoi(s + 1), &mask.s_addr) != 0)
- return -1;
+ return(-1);
} else {
mask.s_addr = inet_addr(s + 1);
}
@@ -1110,5 +1110,5 @@ setnodeaddr(int type, int role, void *ptr, char *arg)
#endif
}
- return 0;
+ return(0);
}
diff --git a/sbin/ipf/ippool/ippool_y.y b/sbin/ipf/ippool/ippool_y.y
index 5ec9b6ef0083..9e01318a78c7 100644
--- a/sbin/ipf/ippool/ippool_y.y
+++ b/sbin/ipf/ippool/ippool_y.y
@@ -426,7 +426,7 @@ seed: IPT_SEED '=' YY_NUMBER { ipht.iph_seed = $3; }
ipv4: YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER
{ if ($1 > 255 || $3 > 255 || $5 > 255 || $7 > 255) {
yyerror("Invalid octet string for IP address");
- return 0;
+ return(0);
}
$$.s_addr = ($1 << 24) | ($3 << 16) | ($5 << 8) | $7;
$$.s_addr = htonl($$.s_addr);
@@ -629,7 +629,7 @@ ippool_parsefile(int fd, char *filename, ioctlfunc_t iocfunc)
if (!fp) {
fprintf(stderr, "fopen(%s) failed: %s\n", filename,
STRERROR(errno));
- return -1;
+ return(-1);
}
} else
fp = stdin;
@@ -638,7 +638,7 @@ ippool_parsefile(int fd, char *filename, ioctlfunc_t iocfunc)
;
if (fp != NULL)
fclose(fp);
- return 0;
+ return(0);
}
@@ -651,14 +651,14 @@ ippool_parsesome(int fd, FILE *fp, ioctlfunc_t iocfunc)
poolioctl = iocfunc;
if (feof(fp))
- return 0;
+ return(0);
i = fgetc(fp);
if (i == EOF)
- return 0;
+ return(0);
if (ungetc(i, fp) == EOF)
- return 0;
+ return(0);
if (feof(fp))
- return 0;
+ return(0);
s = getenv("YYDEBUG");
if (s)
yydebug = atoi(s);
@@ -667,7 +667,7 @@ ippool_parsesome(int fd, FILE *fp, ioctlfunc_t iocfunc)
yyin = fp;
yyparse();
- return 1;
+ return(1);
}
@@ -684,7 +684,7 @@ add_htablehosts(char *url)
hlist = calloc(1, sizeof(*hlist));
if (hlist == NULL)
- return NULL;
+ return(NULL);
if (gethost(hlist->al_family, url, &hlist->al_i6addr) == -1) {
yyerror("Unknown hostname");
@@ -712,7 +712,7 @@ add_htablehosts(char *url)
alist_free(hlist);
- return htop;
+ return(htop);
}
@@ -729,7 +729,7 @@ add_poolhosts(char *url)
hlist = calloc(1, sizeof(*hlist));
if (hlist == NULL)
- return NULL;
+ return(NULL);
if (gethost(hlist->al_family, url, &hlist->al_i6addr) == -1) {
yyerror("Unknown hostname");
@@ -766,7 +766,7 @@ add_poolhosts(char *url)
alist_free(hlist);
- return ptop;
+ return(ptop);
}
@@ -779,7 +779,7 @@ read_whoisfile(char *file)
fp = fopen(file, "r");
if (fp == NULL)
- return NULL;
+ return(NULL);
last = NULL;
ntop = NULL;
@@ -800,7 +800,7 @@ read_whoisfile(char *file)
last = ipn;
}
fclose(fp);
- return ntop;
+ return(ntop);
}