git: 777e494a7634 - main - traceroute6: style(9) fixes

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 03 Jan 2024 18:32:54 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=777e494a7634bbdd8ab0cf403ae22a464669d804

commit 777e494a7634bbdd8ab0cf403ae22a464669d804
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2023-10-27 23:53:44 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-03 17:54:53 +0000

    traceroute6: style(9) fixes
    
    No functional change intended.
    
    Reviewed by:    imp, markj
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/879
---
 usr.sbin/traceroute6/traceroute6.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index c6f7279691de..925020546f27 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -330,7 +330,7 @@ static u_long nprobes = 3;
 static u_long first_hop = 1;
 static u_long max_hops = 30;
 static u_int16_t srcport;
-static u_int16_t port = 32768+666;	/* start udp dest port # for probe packets */
+static u_int16_t port = 32768 + 666;	/* start udp dest port # for probe packets */
 static u_int16_t ident;
 static int tclass = -1;
 static int options;			/* socket options */
@@ -373,7 +373,7 @@ main(int argc, char *argv[])
 	}
 
 	size = sizeof(i);
-	(void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &i, &size, NULL, 0);
+	(void) sysctl(mib, sizeof(mib) / sizeof(mib[0]), &i, &size, NULL, 0);
 	max_hops = i;
 
 	/* specify to tell receiving interface */
@@ -681,7 +681,7 @@ main(int argc, char *argv[])
 		exit(1);
 	}
 	if ((useproto == IPPROTO_SCTP) && (datalen & 3)) {
-		fprintf(stderr, 
+		fprintf(stderr,
 		    "traceroute6: packet size must be a multiple of 4.\n");
 		exit(1);
 	}
@@ -1042,7 +1042,7 @@ wait_for_reply(int sock, struct msghdr *mhdr)
 	FD_SET(sock, fdsp);
 	wait.tv_sec = waittime; wait.tv_usec = 0;
 
-	if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
+	if (select(sock + 1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
 		cc = recvmsg(rcvsock, mhdr, 0);
 
 	free(fdsp);
@@ -1059,14 +1059,14 @@ setpolicy(int so, char *policy)
 	buf = ipsec_set_policy(policy, strlen(policy));
 	if (buf == NULL) {
 		warnx("%s", ipsec_strerror());
-		return -1;
+		return (-1);
 	}
 	(void)setsockopt(so, IPPROTO_IPV6, IPV6_IPSEC_POLICY,
 	    buf, ipsec_get_policylen(buf));
 
 	free(buf);
 
-	return 0;
+	return (0);
 }
 #endif
 
@@ -1103,7 +1103,7 @@ send_probe(int seq, u_long hops)
 	case IPPROTO_UDP:
 		outudp = (struct udphdr *) outpacket;
 		outudp->uh_sport = htons(ident);
-		outudp->uh_dport = htons(port+seq);
+		outudp->uh_dport = htons(port + seq);
 		outudp->uh_ulen = htons(datalen);
 		outudp->uh_sum = 0;
 		outudp->uh_sum = udp_cksum(&Src, &Dst, outpacket, datalen);
@@ -1193,7 +1193,7 @@ send_probe(int seq, u_long hops)
 		fprintf(stderr, "Unknown probe protocol %d.\n", useproto);
 		exit(1);
 	}
-	
+
 	i = send(sndsock, (char *)outpacket, datalen, 0);
 	if (i < 0 || (u_long)i != datalen)  {
 		if (i < 0)
@@ -1286,7 +1286,7 @@ pr_type(int t0)
 		cp = "Unknown";
 		break;
 	}
-	return cp;
+	return (cp);
 }
 
 int
@@ -1354,8 +1354,7 @@ packet_ok(struct msghdr *mhdr, int cc, int seq, u_char *type, u_char *code)
 #else
 		rcvhlim = 0;	/*XXX*/
 #endif
-	}
-	else
+	} else
 		rcvhlim = *hlimp;
 
 	*type = icp->icmp6_type;
@@ -1440,7 +1439,7 @@ packet_ok(struct msghdr *mhdr, int cc, int seq, u_char *type, u_char *code)
 			return (1);
 	}
 	if (verbose) {
-		char sbuf[NI_MAXHOST+1], dbuf[INET6_ADDRSTRLEN];
+		char sbuf[NI_MAXHOST + 1], dbuf[INET6_ADDRSTRLEN];
 		u_int8_t *p;
 		int i;
 
@@ -1602,19 +1601,19 @@ inetname(struct sockaddr *sa)
 		}
 	}
 	if (cp)
-		return cp;
+		return (cp);
 
 	if (cap_getnameinfo(capdns, sa, sa->sa_len, line, sizeof(line), NULL, 0,
 	    NI_NUMERICHOST) != 0)
 		strlcpy(line, "invalid", sizeof(line));
-	return line;
+	return (line);
 }
 
 /*
  * CRC32C routine for the Stream Control Transmission Protocol
  */
 
-#define CRC32C(c, d) (c = (c>>8) ^ crc_c[(c^(d))&0xFF])
+#define CRC32C(c, d) (c = (c >> 8) ^ crc_c[(c ^ (d)) & 0xFF])
 
 static u_int32_t crc_c[256] = {
 	0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4,
@@ -1695,11 +1694,11 @@ sctp_crc32c(void *pack, u_int32_t len)
 		CRC32C(crc32c, buf[i]);
 	crc32c = ~crc32c;
 	byte0  = crc32c & 0xff;
-	byte1  = (crc32c>>8) & 0xff;
-	byte2  = (crc32c>>16) & 0xff;
-	byte3  = (crc32c>>24) & 0xff;
+	byte1  = (crc32c >> 8) & 0xff;
+	byte2  = (crc32c >> 16) & 0xff;
+	byte3  = (crc32c >> 24) & 0xff;
 	crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3);
-	return htonl(crc32c);
+	return (htonl(crc32c));
 }
 
 u_int16_t