Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 2019 20:11:34 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350225 - in head: sbin/ping6 usr.sbin/mld6query usr.sbin/traceroute6
Message-ID:  <201907222011.x6MKBYqW019551@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Mon Jul 22 20:11:33 2019
New Revision: 350225
URL: https://svnweb.freebsd.org/changeset/base/350225

Log:
  Remove the USE_RFC2292BIS option and reap dead code
  
  This option was imported as part of the KAME project in r62627 (in 2000).
  It was turned on unconditionally in r121472 (in 2003) and has been on ever
  since. The old alternative code has bitrotted. Reap the dead code.
  
  Reported by:	Ján Sučan <jansucan@gmail.com>
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D20938

Modified:
  head/sbin/ping6/Makefile
  head/sbin/ping6/ping6.c
  head/usr.sbin/mld6query/Makefile
  head/usr.sbin/mld6query/mld6.c
  head/usr.sbin/traceroute6/Makefile
  head/usr.sbin/traceroute6/traceroute6.c

Modified: head/sbin/ping6/Makefile
==============================================================================
--- head/sbin/ping6/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/sbin/ping6/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -4,7 +4,7 @@ PACKAGE=runtime
 PROG=	ping6
 MAN=	ping6.8
 
-CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS
+CFLAGS+=-DIPSEC -DKAME_SCOPEID
 WARNS?=	3
 
 BINOWN=	root

Modified: head/sbin/ping6/ping6.c
==============================================================================
--- head/sbin/ping6/ping6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/sbin/ping6/ping6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -307,9 +307,7 @@ main(int argc, char *argv[])
 #endif
 	int usepktinfo = 0;
 	struct in6_pktinfo *pktinfo = NULL;
-#ifdef USE_RFC2292BIS
 	struct ip6_rthdr *rthdr = NULL;
-#endif
 #ifdef IPSEC_POLICY_IPSEC
 	char *policy_in = NULL;
 	char *policy_out = NULL;
@@ -902,11 +900,8 @@ main(int argc, char *argv[])
 
 	if (argc > 1) {	/* some intermediate addrs are specified */
 		int hops;
-#ifdef USE_RFC2292BIS
 		int rthdrlen;
-#endif
 
-#ifdef USE_RFC2292BIS
 		rthdrlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1);
 		scmsgp->cmsg_len = CMSG_LEN(rthdrlen);
 		scmsgp->cmsg_level = IPPROTO_IPV6;
@@ -916,11 +911,6 @@ main(int argc, char *argv[])
 		    IPV6_RTHDR_TYPE_0, argc - 1);
 		if (rthdr == NULL)
 			errx(1, "can't initialize rthdr");
-#else  /* old advanced API */
-		if ((scmsgp = (struct cmsghdr *)inet6_rthdr_init(scmsgp,
-		    IPV6_RTHDR_TYPE_0)) == NULL)
-			errx(1, "can't initialize rthdr");
-#endif /* USE_RFC2292BIS */
 
 		for (hops = 0; hops < argc - 1; hops++) {
 			memset(&hints, 0, sizeof(hints));
@@ -933,22 +923,11 @@ main(int argc, char *argv[])
 				errx(1,
 				    "bad addr family of an intermediate addr");
 			sin6 = (struct sockaddr_in6 *)(void *)res->ai_addr;
-#ifdef USE_RFC2292BIS
 			if (inet6_rth_add(rthdr, &sin6->sin6_addr))
 				errx(1, "can't add an intermediate node");
-#else  /* old advanced API */
-			if (inet6_rthdr_add(scmsg, &sin6->sin6_addr,
-			    IPV6_RTHDR_LOOSE))
-				errx(1, "can't add an intermediate node");
-#endif /* USE_RFC2292BIS */
 			freeaddrinfo(res);
 		}
 
-#ifndef USE_RFC2292BIS
-		if (inet6_rthdr_lasthop(scmsgp, IPV6_RTHDR_LOOSE))
-			errx(1, "can't set the last flag");
-#endif
-
 		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
 	}
 
@@ -968,7 +947,6 @@ main(int argc, char *argv[])
 		src.sin6_port = ntohs(DUMMY_PORT);
 		src.sin6_scope_id = dst.sin6_scope_id;
 
-#ifdef USE_RFC2292BIS
 		if (pktinfo &&
 		    setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTINFO,
 		    (void *)pktinfo, sizeof(*pktinfo)))
@@ -988,12 +966,6 @@ main(int argc, char *argv[])
 		    setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR,
 		    (void *)rthdr, (rthdr->ip6r_len + 1) << 3))
 			err(1, "UDP setsockopt(IPV6_RTHDR)");
-#else  /* old advanced API */
-		if (smsghdr.msg_control &&
-		    setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-		    (void *)smsghdr.msg_control, smsghdr.msg_controllen))
-			err(1, "UDP setsockopt(IPV6_PKTOPTIONS)");
-#endif
 
 		if (connect(dummy, (struct sockaddr *)&src, len) < 0)
 			err(1, "UDP connect");
@@ -1785,7 +1757,6 @@ pr_exthdrs(struct msghdr *mhdr)
 	}
 }
 
-#ifdef USE_RFC2292BIS
 static void
 pr_ip6opt(void *extbuf, size_t bufsize)
 {
@@ -1847,17 +1818,7 @@ pr_ip6opt(void *extbuf, size_t bufsize)
 	}
 	return;
 }
-#else  /* !USE_RFC2292BIS */
-/* ARGSUSED */
-static void
-pr_ip6opt(void *extbuf, size_t bufsize __unused)
-{
-	putchar('\n');
-	return;
-}
-#endif /* USE_RFC2292BIS */
 
-#ifdef USE_RFC2292BIS
 static void
 pr_rthdr(void *extbuf, size_t bufsize)
 {
@@ -1912,16 +1873,6 @@ pr_rthdr(void *extbuf, size_t bufsize)
 	return;
 
 }
-
-#else  /* !USE_RFC2292BIS */
-/* ARGSUSED */
-static void
-pr_rthdr(void *extbuf, size_t bufsize __unused)
-{
-	putchar('\n');
-	return;
-}
-#endif /* USE_RFC2292BIS */
 
 static int
 pr_bitrange(u_int32_t v, int soff, int ii)

Modified: head/usr.sbin/mld6query/Makefile
==============================================================================
--- head/usr.sbin/mld6query/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/mld6query/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -18,7 +18,7 @@ PROG=	mld6query
 MAN=	mld6query.8
 SRCS=	mld6.c
 
-CFLAGS+= -DIPSEC -DUSE_RFC2292BIS
+CFLAGS+= -DIPSEC
 
 WARNS?=	2
 

Modified: head/usr.sbin/mld6query/mld6.c
==============================================================================
--- head/usr.sbin/mld6query/mld6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/mld6query/mld6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -203,12 +203,8 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	static struct iovec iov[2];
 	static u_char *cmsgbuf;
 	int cmsglen, hbhlen = 0;
-#ifdef USE_RFC2292BIS
 	void *hbhbuf = NULL, *optp = NULL;
 	int currentlen;
-#else
-	u_int8_t raopt[IP6OPT_RTALERT_LEN];
-#endif 
 	struct in6_pktinfo *pi;
 	struct cmsghdr *cmsgp;
 	u_short rtalert_code = htons(IP6OPT_RTALERT_MLD);
@@ -253,7 +249,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	src.s6_addr[2] = src.s6_addr[3] = 0;
 #endif
 
-#ifdef USE_RFC2292BIS
 	if ((hbhlen = inet6_opt_init(NULL, 0)) == -1)
 		errx(1, "inet6_opt_init(0) failed");
 	if ((hbhlen = inet6_opt_append(NULL, 0, hbhlen, IP6OPT_ROUTER_ALERT, 2,
@@ -262,11 +257,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	if ((hbhlen = inet6_opt_finish(NULL, 0, hbhlen)) == -1)
 		errx(1, "inet6_opt_finish(0) failed");
 	cmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(hbhlen);
-#else
-	hbhlen = sizeof(raopt); 
-	cmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
-	    inet6_option_space(hbhlen);
-#endif 
 
 	if ((cmsgbuf = malloc(cmsglen)) == NULL)
 		errx(1, "can't allocate enough memory for cmsg");
@@ -282,7 +272,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	memcpy(&pi->ipi6_addr, &src, sizeof(pi->ipi6_addr));
 	/* specifiy to insert router alert option in a hop-by-hop opt hdr. */
 	cmsgp = CMSG_NXTHDR(&m, cmsgp);
-#ifdef USE_RFC2292BIS
 	cmsgp->cmsg_len = CMSG_LEN(hbhlen);
 	cmsgp->cmsg_level = IPPROTO_IPV6;
 	cmsgp->cmsg_type = IPV6_HOPOPTS;
@@ -297,15 +286,6 @@ make_msg(int index, struct in6_addr *addr, u_int type,
 	(void)inet6_opt_set_val(optp, 0, &rtalert_code, sizeof(rtalert_code));
 	if ((currentlen = inet6_opt_finish(hbhbuf, hbhlen, currentlen)) == -1)
 		errx(1, "inet6_opt_finish(buf) failed");
-#else  /* old advanced API */
-	if (inet6_option_init((void *)cmsgp, &cmsgp, IPV6_HOPOPTS))
-		errx(1, "inet6_option_init failed\n");
-	raopt[0] = IP6OPT_ROUTER_ALERT;
-	raopt[1] = IP6OPT_RTALERT_LEN - 2;
-	memcpy(&raopt[2], (caddr_t)&rtalert_code, sizeof(u_short));
-	if (inet6_option_append(cmsgp, raopt, 4, 0))
-		errx(1, "inet6_option_append failed\n");
-#endif 
 }
 
 void

Modified: head/usr.sbin/traceroute6/Makefile
==============================================================================
--- head/usr.sbin/traceroute6/Makefile	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/traceroute6/Makefile	Mon Jul 22 20:11:33 2019	(r350225)
@@ -22,7 +22,7 @@ SRCS=	as.c traceroute6.c
 BINOWN=	root
 BINMODE= 4555
 
-CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL
+CFLAGS+= -DIPSEC -DHAVE_POLL
 CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
 
 WARNS?=	3

Modified: head/usr.sbin/traceroute6/traceroute6.c
==============================================================================
--- head/usr.sbin/traceroute6/traceroute6.c	Mon Jul 22 20:04:55 2019	(r350224)
+++ head/usr.sbin/traceroute6/traceroute6.c	Mon Jul 22 20:11:33 2019	(r350225)
@@ -331,9 +331,7 @@ u_long datalen = 20;			/* How much data */
 #define	ICMP6ECHOLEN	8
 /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */
 char rtbuf[2064];
-#ifdef USE_RFC2292BIS
 struct ip6_rthdr *rth;
-#endif
 struct cmsghdr *cmsg;
 
 char *source = NULL;
@@ -435,7 +433,6 @@ main(int argc, char *argv[])
 				    "traceroute6: unknown host %s\n", optarg);
 				exit(1);
 			}
-#ifdef USE_RFC2292BIS
 			if (rth == NULL) {
 				/*
 				 * XXX: We can't detect the number of
@@ -456,12 +453,6 @@ main(int argc, char *argv[])
 				    optarg);
 				exit(1);
 			}
-#else  /* old advanced API */
-			if (cmsg == NULL)
-				cmsg = inet6_rthdr_init(rtbuf, IPV6_RTHDR_TYPE_0);
-			inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr,
-			    IPV6_RTHDR_LOOSE);
-#endif
 			freehostent(hp);
 			break;
 		case 'I':
@@ -763,7 +754,6 @@ main(int argc, char *argv[])
 	if (options & SO_DONTROUTE)
 		(void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
 		    (char *)&on, sizeof(on));
-#ifdef USE_RFC2292BIS
 	if (rth) {/* XXX: there is no library to finalize the header... */
 		rth->ip6r_len = rth->ip6r_segleft * 2;
 		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_RTHDR,
@@ -773,17 +763,6 @@ main(int argc, char *argv[])
 			exit(1);
 		}
 	}
-#else  /* old advanced API */
-	if (cmsg != NULL) {
-		inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE);
-		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-		    rtbuf, cmsg->cmsg_len) < 0) {
-			fprintf(stderr, "setsockopt(IPV6_PKTOPTIONS): %s\n",
-			    strerror(errno));
-			exit(1);
-		}
-	}
-#endif /* USE_RFC2292BIS */
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907222011.x6MKBYqW019551>