Date: Mon, 7 Feb 2022 13:55:57 GMT From: Cy Schubert <cy@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1d8416053ef8 - stable/12 - ipfilter: Adjust userland returns to conform to style(9) Message-ID: <202202071355.217DtvCI085244@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=1d8416053ef88b1d2fa8d7a578fc7f00cb7f8d65 commit 1d8416053ef88b1d2fa8d7a578fc7f00cb7f8d65 Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2021-12-22 02:37:19 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2022-02-07 13:55:12 +0000 ipfilter: Adjust userland returns to conform to style(9) Adjust ipfilter's userland return statements to conform to style(9). (cherry picked from commit 2582ae5740181e0d2bab10003d66ae91c9b56329) --- sbin/ipf/common/genmask.c | 14 +++--- sbin/ipf/common/ipf_y.y | 62 ++++++++++++------------- sbin/ipf/common/lexer.c | 34 +++++++------- sbin/ipf/ipf/bpf_filter.c | 76 +++++++++++++++--------------- sbin/ipf/ipf/ipf.4 | 8 ++-- sbin/ipf/ipf/ipf.5 | 10 ++-- sbin/ipf/ipf/ipf.c | 18 ++++---- sbin/ipf/ipf/ipfcomp.c | 95 ++++++++++++++++++++++---------------- sbin/ipf/ipf/ipl.4 | 2 +- sbin/ipf/ipfs/ipfs.c | 80 ++++++++++++++++---------------- sbin/ipf/ipfstat/ipfstat.c | 84 ++++++++++++++++----------------- sbin/ipf/ipftest/ip_fil.c | 88 +++++++++++++++++------------------ sbin/ipf/ipftest/ipftest.1 | 2 +- sbin/ipf/ipftest/ipftest.c | 42 ++++++++--------- sbin/ipf/iplang/iplang_l.l | 28 +++++------ sbin/ipf/iplang/iplang_y.y | 18 ++++---- sbin/ipf/ipmon/ipmon.c | 52 ++++++++++----------- sbin/ipf/ipmon/ipmon_y.y | 36 +++++++-------- sbin/ipf/ipnat/ipnat.5 | 4 +- sbin/ipf/ipnat/ipnat.c | 6 +-- sbin/ipf/ipnat/ipnat_y.y | 32 ++++++------- sbin/ipf/ippool/ippool.c | 62 ++++++++++++------------- sbin/ipf/ippool/ippool_y.y | 28 +++++------ sbin/ipf/ipscan/ipscan_y.y | 14 +++--- sbin/ipf/ipsend/44arp.c | 14 +++--- sbin/ipf/ipsend/arp.c | 18 ++++---- sbin/ipf/ipsend/dlcommon.c | 24 +++++----- sbin/ipf/ipsend/ip.c | 28 +++++------ sbin/ipf/ipsend/ipresend.c | 2 +- sbin/ipf/ipsend/ipsend.c | 10 ++-- sbin/ipf/ipsend/ipsopt.c | 12 ++--- sbin/ipf/ipsend/iptest.c | 2 +- sbin/ipf/ipsend/resend.c | 8 ++-- sbin/ipf/ipsend/sbpf.c | 14 +++--- sbin/ipf/ipsend/sdlpi.c | 8 ++-- sbin/ipf/ipsend/snit.c | 10 ++-- sbin/ipf/ipsend/sock.c | 38 +++++++-------- sbin/ipf/ipsend/sockraw.c | 10 ++-- sbin/ipf/libipf/addipopt.c | 4 +- sbin/ipf/libipf/alist_new.c | 8 ++-- sbin/ipf/libipf/allocmbt.c | 4 +- sbin/ipf/libipf/bcopywrap.c | 2 +- sbin/ipf/libipf/buildopts.c | 4 +- sbin/ipf/libipf/checkrev.c | 8 ++-- sbin/ipf/libipf/connecttcp.c | 10 ++-- sbin/ipf/libipf/count4bits.c | 6 +-- sbin/ipf/libipf/count6bits.c | 2 +- sbin/ipf/libipf/dupmbt.c | 4 +- sbin/ipf/libipf/facpri.c | 20 ++++---- sbin/ipf/libipf/familyname.c | 6 +-- sbin/ipf/libipf/findword.c | 4 +- sbin/ipf/libipf/ftov.c | 8 ++-- sbin/ipf/libipf/gethost.c | 10 ++-- sbin/ipf/libipf/geticmptype.c | 8 ++-- sbin/ipf/libipf/getifname.c | 20 ++++---- sbin/ipf/libipf/getnattype.c | 4 +- sbin/ipf/libipf/getport.c | 24 +++++----- sbin/ipf/libipf/getportproto.c | 10 ++-- sbin/ipf/libipf/getproto.c | 8 ++-- sbin/ipf/libipf/getsumd.c | 2 +- sbin/ipf/libipf/hostname.c | 12 ++--- sbin/ipf/libipf/icmptypename.c | 8 ++-- sbin/ipf/libipf/inet_addr.c | 22 ++++----- sbin/ipf/libipf/interror.c | 12 ++--- sbin/ipf/libipf/ipf_perror.c | 2 +- sbin/ipf/libipf/ipft_hx.c | 14 +++--- sbin/ipf/libipf/ipft_pc.c | 36 +++++++-------- sbin/ipf/libipf/ipft_tx.c | 68 +++++++++++++-------------- sbin/ipf/libipf/ipoptsec.c | 10 ++-- sbin/ipf/libipf/kmem.c | 20 ++++---- sbin/ipf/libipf/kmemcpywrap.c | 2 +- sbin/ipf/libipf/kvatoname.c | 4 +- sbin/ipf/libipf/load_dstlist.c | 14 +++--- sbin/ipf/libipf/load_dstlistnode.c | 8 ++-- sbin/ipf/libipf/load_file.c | 6 +-- sbin/ipf/libipf/load_hash.c | 14 +++--- sbin/ipf/libipf/load_hashnode.c | 6 +-- sbin/ipf/libipf/load_http.c | 8 ++-- sbin/ipf/libipf/load_pool.c | 12 ++--- sbin/ipf/libipf/load_poolnode.c | 6 +-- sbin/ipf/libipf/load_url.c | 2 +- sbin/ipf/libipf/msgdsize.c | 2 +- sbin/ipf/libipf/nametokva.c | 4 +- sbin/ipf/libipf/ntomask.c | 10 ++-- sbin/ipf/libipf/optname.c | 8 ++-- sbin/ipf/libipf/optvalue.c | 8 ++-- sbin/ipf/libipf/parsefields.c | 2 +- sbin/ipf/libipf/parseipfexpr.c | 4 +- sbin/ipf/libipf/parsewhoisline.c | 34 +++++++------- sbin/ipf/libipf/poolio.c | 8 ++-- sbin/ipf/libipf/portname.c | 6 +-- sbin/ipf/libipf/prependmbt.c | 2 +- sbin/ipf/libipf/printdstl_live.c | 8 ++-- sbin/ipf/libipf/printdstlist.c | 8 ++-- sbin/ipf/libipf/printdstlistnode.c | 8 ++-- sbin/ipf/libipf/printhash.c | 8 ++-- sbin/ipf/libipf/printhash_live.c | 4 +- sbin/ipf/libipf/printhashnode.c | 4 +- sbin/ipf/libipf/printpool.c | 6 +-- sbin/ipf/libipf/printpool_live.c | 4 +- sbin/ipf/libipf/printpoolnode.c | 2 +- sbin/ipf/libipf/printstate.c | 4 +- sbin/ipf/libipf/remove_hash.c | 8 ++-- sbin/ipf/libipf/remove_hashnode.c | 8 ++-- sbin/ipf/libipf/remove_pool.c | 8 ++-- sbin/ipf/libipf/remove_poolnode.c | 8 ++-- sbin/ipf/libipf/save_execute.c | 6 +-- sbin/ipf/libipf/save_file.c | 14 +++--- sbin/ipf/libipf/save_nothing.c | 4 +- sbin/ipf/libipf/save_syslog.c | 10 ++-- sbin/ipf/libipf/save_v1trap.c | 54 +++++++++++----------- sbin/ipf/libipf/save_v2trap.c | 50 ++++++++++---------- sbin/ipf/libipf/tcp_flags.c | 2 +- sbin/ipf/libipf/tcpflags.c | 4 +- sbin/ipf/libipf/v6optvalue.c | 8 ++-- sbin/ipf/libipf/var.c | 22 ++++----- sbin/ipf/libipf/vtof.c | 8 ++-- 117 files changed, 965 insertions(+), 948 deletions(-) diff --git a/sbin/ipf/common/genmask.c b/sbin/ipf/common/genmask.c index 75193e3ea398..581573463c4c 100644 --- a/sbin/ipf/common/genmask.c +++ b/sbin/ipf/common/genmask.c @@ -26,15 +26,15 @@ int genmask(family, msk, mskp) #ifdef USE_INET6 case AF_INET6 : if (inet_pton(AF_INET6, msk, &mskp->in4) != 1) - return -1; + return(-1); break; #endif case AF_INET : if (inet_aton(msk, &mskp->in4) == 0) - return -1; + return(-1); break; default : - return -1; + return(-1); /*NOTREACHED*/ } } else { @@ -47,12 +47,12 @@ int genmask(family, msk, mskp) { case AF_INET6 : if ((*endptr != '\0') || (bits < 0) || (bits > 128)) - return -1; + return(-1); fill6bits(bits, mskp->i6); break; case AF_INET : if (*endptr != '\0' || bits > 32 || bits < 0) - return -1; + return(-1); if (bits == 0) addr = 0; else @@ -60,9 +60,9 @@ int genmask(family, msk, mskp) mskp->in4.s_addr = addr; break; default : - return -1; + return(-1); /*NOTREACHED*/ } } - return 0; + return(0); } diff --git a/sbin/ipf/common/ipf_y.y b/sbin/ipf/common/ipf_y.y index 861d0ccd9a13..ad4200023781 100644 --- a/sbin/ipf/common/ipf_y.y +++ b/sbin/ipf/common/ipf_y.y @@ -1712,7 +1712,7 @@ ipv4_16: YY_NUMBER '.' YY_NUMBER { if ($1 > 255 || $3 > 255) { yyerror("Invalid octet string for IP address"); - return 0; + return(0); } $$.s_addr = ($1 << 24) | ($3 << 16); $$.s_addr = htonl($$.s_addr); @@ -1723,7 +1723,7 @@ ipv4_24: ipv4_16 '.' YY_NUMBER { if ($3 > 255) { yyerror("Invalid octet string for IP address"); - return 0; + return(0); } $$.s_addr |= htonl($3 << 8); } @@ -1732,7 +1732,7 @@ ipv4_24: ipv4: ipv4_24 '.' YY_NUMBER { if ($3 > 255) { yyerror("Invalid octet string for IP address"); - return 0; + return(0); } $$.s_addr |= htonl($3); } @@ -2003,7 +2003,7 @@ ipf_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, char *filename) if (fp == NULL) { fprintf(stderr, "fopen(%s) failed: %s\n", filename, STRERROR(errno)); - return -1; + return(-1); } } else fp = stdin; @@ -2012,7 +2012,7 @@ ipf_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, char *filename) ; if (fp != NULL) fclose(fp); - return 0; + return(0); } @@ -2028,14 +2028,14 @@ ipf_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, FILE *fp) ipfaddfunc = addfunc; if (feof(fp)) - return 0; + return(0); i = fgetc(fp); if (i == EOF) - return 0; + return(0); if (ungetc(i, fp) == 0) - return 0; + return(0); if (feof(fp)) - return 0; + return(0); s = getenv("YYDEBUG"); if (s != NULL) yydebug = atoi(s); @@ -2044,7 +2044,7 @@ ipf_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, FILE *fp) yyin = fp; yyparse(); - return 1; + return(1); } @@ -2121,7 +2121,7 @@ addrule(void) for (f1 = frc; count > 0; count--, f1 = f1->fr_next) { f->fr_next = allocfr(); if (f->fr_next == NULL) - return NULL; + return(NULL); f->fr_next->fr_pnext = &f->fr_next; added++; f = f->fr_next; @@ -2133,7 +2133,7 @@ addrule(void) } } - return f2->fr_next; + return(f2->fr_next); } @@ -2152,15 +2152,15 @@ lookuphost(char *name, i6addr_t *addrp) if (strcmp(name, fr->fr_names + fr->fr_ifnames[i]) == 0) { ifpflag = FRI_DYNAMIC; dynamic = addname(&fr, name); - return 1; + return(1); } } if (gethost(AF_INET, name, addrp) == -1) { fprintf(stderr, "unknown name \"%s\"\n", name); - return -1; + return(-1); } - return 0; + return(0); } @@ -2274,10 +2274,10 @@ newalist(alist_t *ptr) al = malloc(sizeof(*al)); if (al == NULL) - return NULL; + return(NULL); al->al_not = 0; al->al_next = ptr; - return al; + return(al); } @@ -2290,10 +2290,10 @@ makepool(alist_t *list) int num; if (list == NULL) - return 0; + return(0); top = calloc(1, sizeof(*top)); if (top == NULL) - return 0; + return(0); for (n = top, a = list; (n != NULL) && (a != NULL); a = a->al_next) { if (use_inet6 == 1) { @@ -2334,7 +2334,7 @@ makepool(alist_t *list) top = n->ipn_next; free(n); } - return num; + return(num); } @@ -2347,10 +2347,10 @@ makehash(alist_t *list) int num; if (list == NULL) - return 0; + return(0); top = calloc(1, sizeof(*top)); if (top == NULL) - return 0; + return(0); for (n = top, a = list; (n != NULL) && (a != NULL); a = a->al_next) { if (a->al_family == AF_INET6) { @@ -2383,7 +2383,7 @@ makehash(alist_t *list) top = n->ipe_next; free(n); } - return num; + return(num); } @@ -2395,7 +2395,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr) ipfobj_t obj; if (ptr == NULL) - return 0; + return(0); fr = ptr; add = 0; @@ -2442,7 +2442,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr) snprintf(msg, sizeof(msg), "%d:ioctl(zero rule)", fr->fr_flineno); - return ipf_perror_fd(fd, ioctlfunc, msg); + return(ipf_perror_fd(fd, ioctlfunc, msg)); } } else { #ifdef USE_QUAD_T @@ -2462,7 +2462,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr) snprintf(msg, sizeof(msg), "%d:ioctl(delete rule)", fr->fr_flineno); - return ipf_perror_fd(fd, ioctlfunc, msg); + return(ipf_perror_fd(fd, ioctlfunc, msg)); } } } else { @@ -2472,11 +2472,11 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr) snprintf(msg, sizeof(msg), "%d:ioctl(add/insert rule)", fr->fr_flineno); - return ipf_perror_fd(fd, ioctlfunc, msg); + return(ipf_perror_fd(fd, ioctlfunc, msg)); } } } - return 0; + return(0); } static void @@ -2609,7 +2609,7 @@ addname(frentry_t **frp, char *name) frc = f; *frp = f; if (f == NULL) - return -1; + return(-1); if (f->fr_pnext != NULL) *f->fr_pnext = f; f->fr_size += nlen; @@ -2617,7 +2617,7 @@ addname(frentry_t **frp, char *name) f->fr_namelen += nlen; strcpy(f->fr_names + pos, name); f->fr_names[f->fr_namelen] = '\0'; - return pos; + return(pos); } @@ -2641,7 +2641,7 @@ allocfr(void) fr->fr_rif.fd_name = -1; fr->fr_dif.fd_name = -1; } - return fr; + return(fr); } diff --git a/sbin/ipf/common/lexer.c b/sbin/ipf/common/lexer.c index bb401612ad9d..e84181356da4 100644 --- a/sbin/ipf/common/lexer.c +++ b/sbin/ipf/common/lexer.c @@ -69,11 +69,11 @@ yygetc(int docont) c = yytext[yypos++]; if (c == '\n') yylineNum++; - return c; + return(c); } if (yypos == YYBUFSIZ) - return TOOLONG; + return(TOOLONG); if (pos >= string_start && pos <= string_end) { c = string_val[pos - string_start]; @@ -94,7 +94,7 @@ yygetc(int docont) yylast = yypos; yytext[yypos] = '\0'; - return c; + return(c); } @@ -118,8 +118,8 @@ yyswallow(int last) if (c != EOF) yyunputc(c); if (c == last) - return 0; - return -1; + return(0); + return(-1); } @@ -131,7 +131,7 @@ yytexttochar(void) for (i = 0; i < yypos; i++) yychars[i] = (char)(yytext[i] & 0xff); yychars[i] = '\0'; - return yychars; + return(yychars); } @@ -171,7 +171,7 @@ yytexttostr(int offset, int max) str[i - offset] = (char)(yytext[i] & 0xff); str[i - offset] = '\0'; } - return str; + return(str); } @@ -242,7 +242,7 @@ nextchar: lnext = 0; if ((isbuilding == 0) && !ISALNUM(c)) { prior = c; - return c; + return(c); } goto nextchar; } @@ -333,7 +333,7 @@ nextchar: if (yydebug) fprintf(stderr, "reset at EOF\n"); prior = 0; - return 0; + return(0); } if (strchr("=,/;{}()@", c) != NULL) { @@ -599,7 +599,7 @@ done: if (rval == YY_NUMBER) priornum = yylval.num; prior = rval; - return rval; + return(rval); } @@ -609,12 +609,12 @@ static wordtab_t *yyfindkey(key) wordtab_t *w; if (yywordtab == NULL) - return NULL; + return(NULL); for (w = yywordtab; w->w_word != 0; w++) if (strcasecmp(key, w->w_word) == 0) - return w; - return NULL; + return(w); + return(NULL); } @@ -624,12 +624,12 @@ yykeytostr(int num) wordtab_t *w; if (yywordtab == NULL) - return "<unknown>"; + return("<unknown>"); for (w = yywordtab; w->w_word; w++) if (w->w_value == num) - return w->w_word; - return "<unknown>"; + return(w->w_word); + return("<unknown>"); } @@ -640,7 +640,7 @@ yysettab(wordtab_t *words) save = yywordtab; yywordtab = words; - return save; + return(save); } diff --git a/sbin/ipf/ipf/bpf_filter.c b/sbin/ipf/ipf/bpf_filter.c index 85a38a88bf57..32d144b492ce 100644 --- a/sbin/ipf/ipf/bpf_filter.c +++ b/sbin/ipf/ipf/bpf_filter.c @@ -111,7 +111,7 @@ static int m_xhalf(mb_t *, int, int *); (_k) -= len; \ (_m) = (_m)->m_next; \ if ((_m) == 0) \ - return 0; \ + return(0); \ len = M_LEN(m); \ } \ } @@ -129,7 +129,7 @@ m_xword(m, k, err) cp = MTOD(m, u_char *) + k; if (len - k >= 4) { *err = 0; - return EXTRACT_LONG(cp); + return(EXTRACT_LONG(cp)); } m0 = m->m_next; if (m0 == NULL || M_LEN(m0) + len - k < 4) @@ -139,17 +139,17 @@ m_xword(m, k, err) switch (len - k) { case 1: - return (cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2]; + return(cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2]; case 2: - return (cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1]; + return(cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1]; default: - return (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0]; + return(cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0]; } bad: *err = 1; - return 0; + return(0); } static int @@ -165,16 +165,16 @@ m_xhalf(m, k, err) cp = MTOD(m, u_char *) + k; if (len - k >= 2) { *err = 0; - return EXTRACT_SHORT(cp); + return(EXTRACT_SHORT(cp)); } m0 = m->m_next; if (m0 == NULL) goto bad; *err = 0; - return (cp[0] << 8) | MTOD(m0, u_char *)[0]; + return(cp[0] << 8) | MTOD(m0, u_char *)[0]; bad: *err = 1; - return 0; + return(0); } /* @@ -209,7 +209,7 @@ bpf_filter(pc, p, wirelen, buflen) /* * No filter means accept all. */ - return (u_int)-1; + return(u_int)-1; A = 0; X = 0; --pc; @@ -218,21 +218,21 @@ bpf_filter(pc, p, wirelen, buflen) switch (pc->code) { default: - return 0; + return(0); case BPF_RET|BPF_K: - return (u_int)pc->k; + return(u_int)pc->k; case BPF_RET|BPF_A: - return (u_int)A; + return(u_int)A; case BPF_LD|BPF_W|BPF_ABS: k = pc->k; if (k + sizeof(int32) > buflen) { if (m == NULL) - return 0; + return(0); A = m_xword(m, k, &merr); if (merr != 0) - return 0; + return(0); continue; } A = EXTRACT_LONG(&p[k]); @@ -242,10 +242,10 @@ bpf_filter(pc, p, wirelen, buflen) k = pc->k; if (k + sizeof(short) > buflen) { if (m == NULL) - return 0; + return(0); A = m_xhalf(m, k, &merr); if (merr != 0) - return 0; + return(0); continue; } A = EXTRACT_SHORT(&p[k]); @@ -255,7 +255,7 @@ bpf_filter(pc, p, wirelen, buflen) k = pc->k; if (k >= buflen) { if (m == NULL) - return 0; + return(0); n = m; MINDEX(len, n, k); A = MTOD(n, u_char *)[k]; @@ -276,10 +276,10 @@ bpf_filter(pc, p, wirelen, buflen) k = X + pc->k; if (k + sizeof(int32) > buflen) { if (m == NULL) - return 0; + return(0); A = m_xword(m, k, &merr); if (merr != 0) - return 0; + return(0); continue; } A = EXTRACT_LONG(&p[k]); @@ -289,10 +289,10 @@ bpf_filter(pc, p, wirelen, buflen) k = X + pc->k; if (k + sizeof(short) > buflen) { if (m == NULL) - return 0; + return(0); A = m_xhalf(m, k, &merr); if (merr != 0) - return 0; + return(0); continue; } A = EXTRACT_SHORT(&p[k]); @@ -302,7 +302,7 @@ bpf_filter(pc, p, wirelen, buflen) k = X + pc->k; if (k >= buflen) { if (m == NULL) - return 0; + return(0); n = m; MINDEX(len, n, k); A = MTOD(n, u_char *)[k]; @@ -315,7 +315,7 @@ bpf_filter(pc, p, wirelen, buflen) k = pc->k; if (k >= buflen) { if (m == NULL) - return 0; + return(0); n = m; MINDEX(len, n, k); X = (MTOD(n, char *)[k] & 0xf) << 2; @@ -398,7 +398,7 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_ALU|BPF_DIV|BPF_X: if (X == 0) - return 0; + return(0); A /= X; continue; @@ -486,10 +486,10 @@ bpf_validate(f, len) const struct bpf_insn *p; if (len == 0) - return 1; + return(1); if (len < 1 || len > BPF_MAXINSNS) - return 0; + return(0); for (i = 0; i < len; ++i) { p = &f[i]; @@ -511,23 +511,23 @@ bpf_validate(f, len) */ #if 0 if (p->k >= bpf_maxbufsize) - return 0; + return(0); #endif break; case BPF_MEM: if (p->k >= BPF_MEMWORDS) - return 0; + return(0); break; case BPF_LEN: break; default: - return 0; + return(0); } break; case BPF_ST: case BPF_STX: if (p->k >= BPF_MEMWORDS) - return 0; + return(0); break; case BPF_ALU: switch (BPF_OP(p->code)) { @@ -544,9 +544,9 @@ bpf_validate(f, len) * Check for constant division by 0. */ if (BPF_RVAL(p->code) == BPF_K && p->k == 0) - return 0; + return(0); default: - return 0; + return(0); } break; case BPF_JMP: @@ -570,17 +570,17 @@ bpf_validate(f, len) switch (BPF_OP(p->code)) { case BPF_JA: if (from + p->k < from || from + p->k >= len) - return 0; + return(0); break; case BPF_JEQ: case BPF_JGT: case BPF_JGE: case BPF_JSET: if (from + p->jt >= len || from + p->jf >= len) - return 0; + return(0); break; default: - return 0; + return(0); } break; case BPF_RET: @@ -588,8 +588,8 @@ bpf_validate(f, len) case BPF_MISC: break; default: - return 0; + return(0); } } - return BPF_CLASS(f[len - 1].code) == BPF_RET; + return(BPF_CLASS(f[len - 1].code) == BPF_RET); } diff --git a/sbin/ipf/ipf/ipf.4 b/sbin/ipf/ipf/ipf.4 index 73a17a0cc8d3..559e48a3c6a5 100644 --- a/sbin/ipf/ipf/ipf.4 +++ b/sbin/ipf/ipf/ipf.4 @@ -91,7 +91,7 @@ typedef struct frentry { u_short fr_skip; /* # of rules to skip */ u_short fr_loglevel; /* syslog log facility + priority */ int (*fr_func)(int, ip_t *, fr_info_t *)); - char fr_icode; /* return ICMP code */ +( char fr_icode; /* return ICMP code */); char fr_ifname[IFNAMSIZ]; #ifdef BSD char fr_oifname[IFNAMSIZ]; @@ -118,8 +118,8 @@ Flags which are recognised in fr_flags: FR_LOGP 0x000012 /* Log-pass */ FR_LOGBODY 0x000020 /* log the body of packets too */ FR_LOGFIRST 0x000040 /* log only the first packet to match */ - FR_RETRST 0x000080 /* return a TCP RST packet if blocked */ - FR_RETICMP 0x000100 /* return an ICMP packet if blocked */ +( FR_RETRST 0x000080 /* return a TCP RST packet if blocked */); +( FR_RETICMP 0x000100 /* return an ICMP packet if blocked */); FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */ FR_NOMATCH 0x000200 /* no match occured */ FR_ACCOUNT 0x000400 /* count packet bytes */ @@ -210,7 +210,7 @@ struct filterstats { u_long fr_npkl; /* packets unmatched and logged */ u_long fr_pkl; /* packets logged */ u_long fr_skip; /* packets to be logged but buffer full */ - u_long fr_ret; /* packets for which a return is sent */ +( u_long fr_ret; /* packets for which a return is sent */); u_long fr_acct; /* packets for which counting was performed */ u_long fr_bnfr; /* bad attempts to allocate fragment state */ u_long fr_nfr; /* new fragment state kept */ diff --git a/sbin/ipf/ipf/ipf.5 b/sbin/ipf/ipf/ipf.5 index 8ef56493df5a..2b5d756531eb 100644 --- a/sbin/ipf/ipf/ipf.5 +++ b/sbin/ipf/ipf/ipf.5 @@ -108,7 +108,7 @@ auth rules cause the matching packet to be queued up for processing by a user space program. The user space program is responsible for making an ioctl system call to collect the information about the queued -packet and another ioctl system call to return the verdict (block, +packet( and another ioctl system call to return the verdict (block,); pass, etc) on what to do with the packet. In the event that the queue becomes full, the packets will end up being dropped. .HP @@ -224,7 +224,7 @@ To address this problem, a block rule can be qualified in two ways. The first of these is specific to TCP and instructs IPFilter to send back a reset (RST) packet. This packet indicates to the remote system that the packet it sent has been rejected and that it shouldn't make any further -attempts to send packets to that port. Telling IPFilter to return a TCP +attempts( to send packets to that port. Telling IPFilter to return a TCP); RST packet in response to something that has been received is achieved with the return-rst keyword like this: .PP @@ -240,18 +240,18 @@ For all of the other protocols handled by the IP protocol suite, to send back an error indicating that the received packet was dropped requires sending back an ICMP error packet. Whilst these can also be used for TCP, the sending host may not treat the received ICMP error as a hard error -in the same way as it does the TCP RST packet. To return an ICMP error +in( the same way as it does the TCP RST packet. To return an ICMP error); it is necessary to place return-icmp after the block keyword like this: .PP .nf block return-icmp in proto udp from any to 192.168.0.1/24 .fi .PP -When electing to return an ICMP error packet, it is also possible to +When( electing to return an ICMP error packet, it is also possible to); select what type of ICMP error is returned. Whilst the full compliment of ICMP unreachable codes can be used by specifying a number instead of the string below, only the following should be used in conjunction with -return-icmp. Which return code to use is a choice to be made when +return-icmp.( Which return code to use is a choice to be made when); weighing up the pro's and con's. Using some of the codes may make it more obvious that a firewall is being used rather than just the host not responding. diff --git a/sbin/ipf/ipf/ipf.c b/sbin/ipf/ipf/ipf.c index 3567a82484fb..0cd393f37d5e 100644 --- a/sbin/ipf/ipf/ipf.c +++ b/sbin/ipf/ipf/ipf.c @@ -174,11 +174,11 @@ static int opendevice(char *ipfdev, int check) { if (opts & OPT_DONOTHING) - return -2; + return(-2); if (check && checkrev(ipfname) == -1) { fprintf(stderr, "User/kernel version check failed\n"); - return -2; + return(-2); } if (!ipfdev) @@ -188,7 +188,7 @@ opendevice(char *ipfdev, int check) if ((fd = open(ipfdev, O_RDWR)) == -1) if ((fd = open(ipfdev, O_RDONLY)) == -1) ipferror(fd, "open device"); - return fd; + return(fd); } @@ -208,9 +208,9 @@ get_flags(void) if ((opendevice(ipfname, 1) != -2) && (ioctl(fd, SIOCGETFF, &i) == -1)) { ipferror(fd, "SIOCGETFF"); - return 0; + return(0); } - return i; + return(i); } @@ -256,7 +256,7 @@ ipf_interceptadd(int fd, ioctlfunc_t ioctlfunc, void *ptr) if (ipf_addrule(fd, ioctlfunc, ptr) != 0) exitstatus = 1; - return 0; + return(0); } @@ -527,13 +527,13 @@ showversion(void) if ((vfd = open(ipfname, O_RDONLY)) == -1) { perror("open device"); - return 1; + return(1); } if (ioctl(vfd, SIOCGETFS, &ipfo)) { ipferror(vfd, "ioctl(SIOCGETFS)"); close(vfd); - return 1; + return(1); } close(vfd); flags = get_flags(); @@ -574,5 +574,5 @@ showversion(void) printf("Active list: %d\n", fio.f_active); printf("Feature mask: %#x\n", fio.f_features); - return 0; + return(0); } diff --git a/sbin/ipf/ipf/ipfcomp.c b/sbin/ipf/ipf/ipfcomp.c index 105ff2b852e8..19a61c8bb0e0 100644 --- a/sbin/ipf/ipf/ipfcomp.c +++ b/sbin/ipf/ipf/ipfcomp.c @@ -62,8 +62,8 @@ static FILE *cfile = NULL; * This is called once per filter rule being loaded to emit data structures * required. */ -void -printc(frentry_t *fr) +void printc(fr) + frentry_t *fr; { u_long *ulp; char *and; @@ -162,8 +162,9 @@ printc(frentry_t *fr) static frgroup_t *groups = NULL; -static void -addrule(FILE *fp, frentry_t *fr) +static void addrule(fp, fr) + FILE *fp; + frentry_t *fr; { frentry_t *f, **fpp; frgroup_t *g; @@ -242,27 +243,30 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n", } *** 6134 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202071355.217DtvCI085244>