Re: git: 2582ae574018 - main - ipfilter: Adjust userland returns to conform to style(9)

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Tue, 04 Jan 2022 02:31:25 UTC
On 4 Jan 2022, at 02:07, Cy Schubert <cy@FreeBSD.org> wrote:
> 
> The branch main has been updated by cy:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=2582ae5740181e0d2bab10003d66ae91c9b56329
> 
> commit 2582ae5740181e0d2bab10003d66ae91c9b56329
> Author:     Cy Schubert <cy@FreeBSD.org>
> AuthorDate: 2021-12-22 02:37:19 +0000
> Commit:     Cy Schubert <cy@FreeBSD.org>
> CommitDate: 2022-01-04 02:06:43 +0000
> 
>    ipfilter: Adjust userland returns to conform to style(9)
> 
>    Adjust ipfilter's userland return statements to conform to style(9).
> 
>    MFC after:      1 month
> ---
> 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);

As with the kernel commit; needs a space.

> [...]
> 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 */);

Something’s gone horribly wrong throughout this file.

>         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 ***