summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2015-11-30 20:52:28 +0000
committerjca <jca@openbsd.org>2015-11-30 20:52:28 +0000
commit76d6007938c8b56391e9554c36fea46fea04872c (patch)
tree9d18c1cd9b9ec01b4ab208ee05a6c5a4aa86550b
parentremove table-passwd, table-sqlite, and table-ldap (diff)
downloadwireguard-openbsd-76d6007938c8b56391e9554c36fea46fea04872c.tar.xz
wireguard-openbsd-76d6007938c8b56391e9554c36fea46fea04872c.zip
Remove the already disabled Router Renumbering support (RFC2894).
This code has only been reachable for two months after rtadvd has been imported into the tree. This unsafe protocol is supposed to be used along with IPsec and rrenumd(8), a KAME tool that we don't have. I couldn't find an example of use in the real world. ok sthen@ florian@ millter@
-rw-r--r--usr.sbin/rtadvd/Makefile4
-rw-r--r--usr.sbin/rtadvd/rrenum.c465
-rw-r--r--usr.sbin/rtadvd/rrenum.h34
-rw-r--r--usr.sbin/rtadvd/rtadvd.826
-rw-r--r--usr.sbin/rtadvd/rtadvd.c57
5 files changed, 9 insertions, 577 deletions
diff --git a/usr.sbin/rtadvd/Makefile b/usr.sbin/rtadvd/Makefile
index e56e5af76fb..c81319ce9d2 100644
--- a/usr.sbin/rtadvd/Makefile
+++ b/usr.sbin/rtadvd/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.7 2015/10/25 21:23:42 jca Exp $
+# $OpenBSD: Makefile,v 1.8 2015/11/30 20:52:28 jca Exp $
PROG= rtadvd
-SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c dump.c log.c
+SRCS= rtadvd.c advcap.c if.c config.c timer.c dump.c log.c
CFLAGS+=-Wall
MAN= rtadvd.8 rtadvd.conf.5
diff --git a/usr.sbin/rtadvd/rrenum.c b/usr.sbin/rtadvd/rrenum.c
deleted file mode 100644
index f42b4a827a3..00000000000
--- a/usr.sbin/rtadvd/rrenum.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* $OpenBSD: rrenum.c,v 1.18 2015/01/16 06:40:20 deraadt Exp $ */
-/* $KAME: rrenum.c,v 1.11 2002/05/21 14:26:55 itojun Exp $ */
-
-/*
- * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-#include <sys/queue.h>
-
-#include <net/if.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet6/in6_var.h>
-#include <netinet/icmp6.h>
-
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include "rtadvd.h"
-#include "rrenum.h"
-#include "if.h"
-#include "log.h"
-
-#define RR_ISSET_SEGNUM(segnum_bits, segnum) \
- ((((segnum_bits)[(segnum) >> 5]) & (1 << ((segnum) & 31))) != 0)
-#define RR_SET_SEGNUM(segnum_bits, segnum) \
- (((segnum_bits)[(segnum) >> 5]) |= (1 << ((segnum) & 31)))
-
-struct rr_operation {
- u_long rro_seqnum;
- u_long rro_segnum_bits[8];
-};
-
-static struct rr_operation rro;
-static int rr_rcvifindex;
-static int rrcmd2pco[RPM_PCO_MAX] = {
- 0,
- SIOCAIFPREFIX_IN6,
- SIOCCIFPREFIX_IN6,
- SIOCSGIFPREFIX_IN6
-};
-static int s = -1;
-
-/*
- * Check validity of a Prefix Control Operation(PCO).
- * Return 0 on success, 1 on failure.
- */
-static int
-rr_pco_check(int len, struct rr_pco_match *rpm)
-{
- struct rr_pco_use *rpu, *rpulim;
- int checklen;
-
- /* rpm->rpm_len must be (4N * 3) as router-renum-05.txt */
- if ((rpm->rpm_len - 3) < 0 || /* must be at least 3 */
- (rpm->rpm_len - 3) & 0x3) { /* must be multiple of 4 */
- log_warnx("rpm_len %d is not 4N * 3", rpm->rpm_len);
- return 1;
- }
- /* rpm->rpm_code must be valid value */
- switch (rpm->rpm_code) {
- case RPM_PCO_ADD:
- case RPM_PCO_CHANGE:
- case RPM_PCO_SETGLOBAL:
- break;
- default:
- log_warnx("unknown rpm_code %d", rpm->rpm_code);
- return 1;
- }
- /* rpm->rpm_matchlen must be 0 to 128 inclusive */
- if (rpm->rpm_matchlen > 128) {
- log_warnx("rpm_matchlen %d is over 128", rpm->rpm_matchlen);
- return 1;
- }
-
- /*
- * rpu->rpu_uselen, rpu->rpu_keeplen, and sum of them must be
- * between 0 and 128 inclusive
- */
- for (rpu = (struct rr_pco_use *)(rpm + 1),
- rpulim = (struct rr_pco_use *)((char *)rpm + len);
- rpu < rpulim;
- rpu += 1) {
- checklen = rpu->rpu_uselen;
- checklen += rpu->rpu_keeplen;
- /*
- * omit these check, because either of rpu_uselen
- * and rpu_keeplen is unsigned char
- * (128 > rpu_uselen > 0)
- * (128 > rpu_keeplen > 0)
- * (rpu_uselen + rpu_keeplen > 0)
- */
- if (checklen > 128) {
- log_warnx("sum of rpu_uselen %d and"
- " rpu_keeplen %d is %d(over 128)",
- rpu->rpu_uselen,
- rpu->rpu_keeplen,
- rpu->rpu_uselen + rpu->rpu_keeplen);
- return 1;
- }
- }
- return 0;
-}
-
-static void
-do_use_prefix(int len, struct rr_pco_match *rpm,
- struct in6_rrenumreq *irr, int ifindex)
-{
- struct rr_pco_use *rpu, *rpulim;
- struct rainfo *rai;
- struct prefix *pp;
-
- rpu = (struct rr_pco_use *)(rpm + 1);
- rpulim = (struct rr_pco_use *)((char *)rpm + len);
-
- if (rpu == rpulim) { /* no use prefix */
- if (rpm->rpm_code == RPM_PCO_ADD)
- return;
-
- irr->irr_u_uselen = 0;
- irr->irr_u_keeplen = 0;
- irr->irr_raf_mask_onlink = 0;
- irr->irr_raf_mask_auto = 0;
- irr->irr_vltime = 0;
- irr->irr_pltime = 0;
- memset(&irr->irr_flags, 0, sizeof(irr->irr_flags));
- irr->irr_useprefix.sin6_len = 0; /* let it mean, no addition */
- irr->irr_useprefix.sin6_family = 0;
- irr->irr_useprefix.sin6_addr = in6addr_any;
- if (ioctl(s, rrcmd2pco[rpm->rpm_code], (caddr_t)irr) < 0 &&
- errno != EADDRNOTAVAIL)
- log_warn("ioctl");
- return;
- }
-
- for (rpu = (struct rr_pco_use *)(rpm + 1),
- rpulim = (struct rr_pco_use *)((char *)rpm + len);
- rpu < rpulim;
- rpu += 1) {
- /* init in6_rrenumreq fields */
- irr->irr_u_uselen = rpu->rpu_uselen;
- irr->irr_u_keeplen = rpu->rpu_keeplen;
- irr->irr_raf_mask_onlink =
- (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK) == 0 ? 0 : 1;
- irr->irr_raf_mask_auto =
- (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO) == 0 ? 0 : 1;
- irr->irr_vltime = ntohl(rpu->rpu_vltime);
- irr->irr_pltime = ntohl(rpu->rpu_pltime);
- irr->irr_raf_onlink =
- (rpu->rpu_raflags & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK) == 0 ? 0 : 1;
- irr->irr_raf_auto =
- (rpu->rpu_raflags & ICMP6_RR_PCOUSE_RAFLAGS_AUTO) == 0 ? 0 : 1;
- irr->irr_rrf_decrvalid =
- (rpu->rpu_flags & ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME) == 0 ? 0 : 1;
- irr->irr_rrf_decrprefd =
- (rpu->rpu_flags & ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME) == 0 ? 0 : 1;
- irr->irr_useprefix.sin6_len = sizeof(irr->irr_useprefix);
- irr->irr_useprefix.sin6_family = AF_INET6;
- irr->irr_useprefix.sin6_addr = rpu->rpu_prefix;
-
- if (ioctl(s, rrcmd2pco[rpm->rpm_code], (caddr_t)irr) < 0 &&
- errno != EADDRNOTAVAIL)
- log_warn("ioctl");
-
- /* very adhoc: should be rewritten */
- if (rpm->rpm_code == RPM_PCO_CHANGE &&
- IN6_ARE_ADDR_EQUAL(&rpm->rpm_prefix, &rpu->rpu_prefix) &&
- rpm->rpm_matchlen == rpu->rpu_uselen &&
- rpu->rpu_uselen == rpu->rpu_keeplen) {
- if ((rai = if_indextorainfo(ifindex)) == NULL)
- continue; /* non-advertising IF */
-
- TAILQ_FOREACH(pp, &rai->prefixes, entry) {
- struct timeval now;
-
- if (prefix_match(&pp->prefix, pp->prefixlen,
- &rpm->rpm_prefix,
- rpm->rpm_matchlen)) {
- /* change parameters */
- pp->validlifetime = ntohl(rpu->rpu_vltime);
- pp->preflifetime = ntohl(rpu->rpu_pltime);
- if (irr->irr_rrf_decrvalid) {
- gettimeofday(&now, 0);
- pp->vltimeexpire =
- now.tv_sec + pp->validlifetime;
- } else
- pp->vltimeexpire = 0;
- if (irr->irr_rrf_decrprefd) {
- gettimeofday(&now, 0);
- pp->pltimeexpire =
- now.tv_sec + pp->preflifetime;
- } else
- pp->pltimeexpire = 0;
- }
- }
- }
- }
-}
-
-/*
- * process a Prefix Control Operation(PCO).
- * return 0 on success, 1 on failure
- */
-static int
-do_pco(struct icmp6_router_renum *rr, int len, struct rr_pco_match *rpm)
-{
- int ifindex = 0;
- struct in6_rrenumreq irr;
-
- if ((rr_pco_check(len, rpm) != 0))
- return 1;
-
- if (s == -1 && (s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- fatal("socket");
-
- memset(&irr, 0, sizeof(irr));
- irr.irr_origin = PR_ORIG_RR;
- irr.irr_m_len = rpm->rpm_matchlen;
- irr.irr_m_minlen = rpm->rpm_minlen;
- irr.irr_m_maxlen = rpm->rpm_maxlen;
- irr.irr_matchprefix.sin6_len = sizeof(irr.irr_matchprefix);
- irr.irr_matchprefix.sin6_family = AF_INET6;
- irr.irr_matchprefix.sin6_addr = rpm->rpm_prefix;
-
- while (if_indextoname(++ifindex, irr.irr_name)) {
- /*
- * if ICMP6_RR_FLAGS_FORCEAPPLY(A flag) is 0 and IFF_UP is off,
- * the interface is not applied
- */
- if ((rr->rr_flags & ICMP6_RR_FLAGS_FORCEAPPLY) == 0 &&
- (iflist[ifindex]->ifm_flags & IFF_UP) == 0)
- continue;
- /* TODO: interface scope check */
- do_use_prefix(len, rpm, &irr, ifindex);
- }
- if (errno == ENXIO)
- return 0;
- else if (errno) {
- log_warn("if_indextoname");
- return 1;
- }
- return 0;
-}
-
-/*
- * call do_pco() for each Prefix Control Operations(PCOs) in a received
- * Router Renumbering Command packet.
- * return 0 on success, 1 on failure
- */
-static int
-do_rr(int len, struct icmp6_router_renum *rr)
-{
- struct rr_pco_match *rpm;
- char *cp, *lim;
-
- lim = (char *)rr + len;
- cp = (char *)(rr + 1);
- len -= sizeof(struct icmp6_router_renum);
-
- /* get iflist block from kernel again, to get up-to-date information */
- init_iflist();
-
- while (cp < lim) {
- int rpmlen;
-
- rpm = (struct rr_pco_match *)cp;
- if (len < sizeof(struct rr_pco_match)) {
- tooshort:
- log_warnx("pkt too short. left len = %d. "
- "garbage at end of pkt?", len);
- return 1;
- }
- rpmlen = rpm->rpm_len << 3;
- if (len < rpmlen)
- goto tooshort;
-
- if (do_pco(rr, rpmlen, rpm)) {
- log_warn("invalid PCO");
- goto next;
- }
-
- next:
- cp += rpmlen;
- len -= rpmlen;
- }
-
- return 0;
-}
-
-/*
- * check validity of a router renumbering command packet
- * return 0 on success, 1 on failure
- */
-static int
-rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from,
- struct in6_addr *dst)
-{
- u_char ntopbuf[INET6_ADDRSTRLEN];
-
- /* omit rr minimal length check. hope kernel have done it. */
- /* rr_command length check */
- if (len < (sizeof(struct icmp6_router_renum) +
- sizeof(struct rr_pco_match))) {
- log_warnx("rr_command len %d is too short", len);
- return 1;
- }
-
- /* destination check. only for multicast. omit unicast check. */
- if (IN6_IS_ADDR_MULTICAST(dst) && !IN6_IS_ADDR_MC_LINKLOCAL(dst) &&
- !IN6_IS_ADDR_MC_SITELOCAL(dst)) {
- log_warnx("dst mcast addr %s is illegal",
- inet_ntop(AF_INET6, dst, ntopbuf, INET6_ADDRSTRLEN));
- return 1;
- }
-
- /* seqnum and segnum check */
- if (rro.rro_seqnum > rr->rr_seqnum) {
- log_warnx("rcvd old seqnum %d from %s",
- (u_int32_t)ntohl(rr->rr_seqnum),
- inet_ntop(AF_INET6, from, ntopbuf, INET6_ADDRSTRLEN));
- return 1;
- }
- if (rro.rro_seqnum == rr->rr_seqnum &&
- (rr->rr_flags & ICMP6_RR_FLAGS_TEST) == 0 &&
- RR_ISSET_SEGNUM(rro.rro_segnum_bits, rr->rr_segnum)) {
- if ((rr->rr_flags & ICMP6_RR_FLAGS_REQRESULT) != 0)
- log_warnx("rcvd duped segnum %d from %s",
- rr->rr_segnum,
- inet_ntop(AF_INET6, from, ntopbuf,
- INET6_ADDRSTRLEN));
- return 0;
- }
-
- /* update seqnum */
- if (rro.rro_seqnum != rr->rr_seqnum) {
- /* then must be "<" */
-
- /* init rro_segnum_bits */
- memset(rro.rro_segnum_bits, 0,
- sizeof(rro.rro_segnum_bits));
- }
- rro.rro_seqnum = rr->rr_seqnum;
-
- return 0;
-}
-
-static void
-rr_command_input(int len, struct icmp6_router_renum *rr,
- struct in6_addr *from, struct in6_addr *dst)
-{
- /* rr_command validity check */
- if (rr_command_check(len, rr, from, dst))
- goto failed;
- if ((rr->rr_flags & (ICMP6_RR_FLAGS_TEST|ICMP6_RR_FLAGS_REQRESULT)) ==
- ICMP6_RR_FLAGS_TEST)
- return;
-
- /* do router renumbering */
- if (do_rr(len, rr)) {
- goto failed;
- }
-
- /* update segnum */
- RR_SET_SEGNUM(rro.rro_segnum_bits, rr->rr_segnum);
-
- return;
-
- failed:
- log_warnx("received RR was invalid");
- return;
-}
-
-void
-rr_input(int len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
- struct sockaddr_in6 *from, struct in6_addr *dst)
-{
- u_char ntopbuf[2][INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
-
- log_debug("RR received from %s to %s on %s",
- inet_ntop(AF_INET6, &from->sin6_addr,
- ntopbuf[0], INET6_ADDRSTRLEN),
- inet_ntop(AF_INET6, &dst, ntopbuf[1], INET6_ADDRSTRLEN),
- if_indextoname(pi->ipi6_ifindex, ifnamebuf));
-
- /* packet validation based on Section 4.1 of RFC2894 */
- if (len < sizeof(struct icmp6_router_renum)) {
- log_info("RR short message (size %d) from %s to %s on %s",
- len,
- inet_ntop(AF_INET6, &from->sin6_addr,
- ntopbuf[0], INET6_ADDRSTRLEN),
- inet_ntop(AF_INET6, &dst, ntopbuf[1], INET6_ADDRSTRLEN),
- if_indextoname(pi->ipi6_ifindex, ifnamebuf));
- return;
- }
-
- /*
- * If the IPv6 destination address is neither an All Routers multicast
- * address [AARCH] nor one of the receiving router's unicast addresses,
- * the message MUST be discarded and SHOULD be logged to network
- * management.
- * We rely on the kernel input routine for unicast addresses, and thus
- * check multicast destinations only.
- */
- if (IN6_IS_ADDR_MULTICAST(&pi->ipi6_addr) &&
- !IN6_ARE_ADDR_EQUAL(&in6a_site_allrouters, &pi->ipi6_addr)) {
- log_info("RR message with invalid destination (%s) "
- "from %s on %s",
- inet_ntop(AF_INET6, &dst, ntopbuf[0], INET6_ADDRSTRLEN),
- inet_ntop(AF_INET6, &from->sin6_addr,
- ntopbuf[1], INET6_ADDRSTRLEN),
- if_indextoname(pi->ipi6_ifindex, ifnamebuf));
- return;
- }
-
- rr_rcvifindex = pi->ipi6_ifindex;
-
- switch (rr->rr_code) {
- case ICMP6_ROUTER_RENUMBERING_COMMAND:
- rr_command_input(len, rr, &from->sin6_addr, dst);
- /* TODO: send reply msg */
- break;
- case ICMP6_ROUTER_RENUMBERING_RESULT:
- /* RESULT will be processed by rrenumd */
- break;
- case ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET:
- /* TODO: sequence number reset */
- break;
- default:
- log_warnx("received unknown code %d", rr->rr_code);
- break;
-
- }
-
- return;
-}
diff --git a/usr.sbin/rtadvd/rrenum.h b/usr.sbin/rtadvd/rrenum.h
deleted file mode 100644
index 291712320d6..00000000000
--- a/usr.sbin/rtadvd/rrenum.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $OpenBSD: rrenum.h,v 1.5 2002/02/17 19:42:39 millert Exp $ */
-/* $KAME: rrenum.h,v 1.3 2001/01/21 15:37:14 itojun Exp $ */
-
-/*
- * Copyright (C) 1998 WIDE Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-void rr_input(int, struct icmp6_router_renum *, struct in6_pktinfo *,
- struct sockaddr_in6 *, struct in6_addr *);
diff --git a/usr.sbin/rtadvd/rtadvd.8 b/usr.sbin/rtadvd/rtadvd.8
index e826aeaad9c..34d928c0c33 100644
--- a/usr.sbin/rtadvd/rtadvd.8
+++ b/usr.sbin/rtadvd/rtadvd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rtadvd.8,v 1.32 2015/10/25 21:23:42 jca Exp $
+.\" $OpenBSD: rtadvd.8,v 1.33 2015/11/30 20:52:28 jca Exp $
.\" $KAME: rtadvd.8,v 1.18 2002/04/28 10:43:02 jinmei Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 25 2015 $
+.Dd $Mdocdate: November 30 2015 $
.Dt RTADVD 8
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Nd router advertisement daemon
.Sh SYNOPSIS
.Nm
-.Op Fl dMRs
+.Op Fl ds
.Op Fl c Ar configfile
.Ar interface ...
.Sh DESCRIPTION
@@ -101,30 +101,10 @@ If this option is specified,
.Nm
will run in the foreground and log to
.Em stderr .
-.It Fl M
-Specify an interface to join the all-routers site-local multicast group.
-By default,
-.Nm
-tries to join the first advertising interface appearing on the command
-line.
-This option has meaning only with the
-.Fl R
-option, which enables routing renumbering protocol support.
.\".It Fl m
.\"Enables Mobile IPv6 support.
.\"This changes the content of router advertisement option, as well as
.\"permitted configuration directives.
-.It Fl R
-Accept router renumbering requests.
-If you enable it, an
-.Xr ipsec 4
-setup is suggested for security reasons.
-.\"On KAME-based systems,
-.\".Xr rrenumd 8
-.\"generates router renumbering request packets.
-This option is currently disabled, and is ignored by
-.Nm
-with a warning message.
.It Fl s
Do not add or delete prefixes dynamically.
Only statically configured prefixes, if any, will be advertised.
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index 005fbf246dd..91f259409a6 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtadvd.c,v 1.58 2015/10/25 22:11:34 jca Exp $ */
+/* $OpenBSD: rtadvd.c,v 1.59 2015/11/30 20:52:28 jca Exp $ */
/* $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */
/*
@@ -58,7 +58,6 @@
#include <pwd.h>
#include "rtadvd.h"
-#include "rrenum.h"
#include "advcap.h"
#include "timer.h"
#include "if.h"
@@ -78,11 +77,8 @@ struct iovec rcviov[2];
struct iovec sndiov[2];
struct sockaddr_in6 from;
struct sockaddr_in6 sin6_allnodes = {sizeof(sin6_allnodes), AF_INET6};
-struct in6_addr in6a_site_allrouters;
-static char *mcastif;
int sock;
int rtsock = -1;
-int accept_rr = 0;
int dflag = 0, sflag = 0;
int log_perror = 0;
@@ -166,7 +162,7 @@ main(int argc, char *argv[])
closefrom(3);
/* get command line options and arguments */
-#define OPTIONS "c:dM:Rs"
+#define OPTIONS "c:ds"
while ((ch = getopt(argc, argv, OPTIONS)) != -1) {
#undef OPTIONS
switch (ch) {
@@ -176,15 +172,6 @@ main(int argc, char *argv[])
case 'd':
dflag = 1;
break;
- case 'M':
- mcastif = optarg;
- break;
- case 'R':
- fprintf(stderr, "rtadvd: "
- "the -R option is currently ignored.\n");
- /* accept_rr = 1; */
- /* run anyway... */
- break;
case 's':
sflag = 1;
break;
@@ -194,7 +181,7 @@ main(int argc, char *argv[])
argv += optind;
if (argc == 0) {
fprintf(stderr,
- "usage: rtadvd [-dMRs] [-c configfile] "
+ "usage: rtadvd [-ds] [-c configfile] "
"interface ...\n");
exit(1);
}
@@ -631,15 +618,6 @@ rtadvd_input(void)
}
ra_input(i, (struct nd_router_advert *)icp, pi, &from);
break;
- case ICMP6_ROUTER_RENUMBERING:
- if (accept_rr == 0) {
- log_warnx("received a router renumbering "
- "message, but not allowed to be accepted");
- break;
- }
- rr_input(i, (struct icmp6_router_renum *)icp, pi, &from,
- &dst);
- break;
default:
/*
* Note that this case is POSSIBLE, especially just
@@ -1221,11 +1199,9 @@ sock_open(void)
ICMP6_FILTER_SETBLOCKALL(&filt);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filt);
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filt);
- if (accept_rr)
- ICMP6_FILTER_SETPASS(ICMP6_ROUTER_RENUMBERING, &filt);
if (setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filt, sizeof(filt))
< 0)
- fatal("IICMP6_FILTER");
+ fatal("ICMP6_FILTER");
/*
* join all routers multicast address on each advertising interface.
@@ -1244,31 +1220,6 @@ sock_open(void)
ra = SLIST_FIRST(&ralist);
- /*
- * When attending router renumbering, join all-routers site-local
- * multicast group.
- */
- if (accept_rr) {
- if (inet_pton(AF_INET6, ALLROUTERS_SITE,
- &in6a_site_allrouters) != 1)
- fatal("inet_pton failed(library bug?)");
- mreq.ipv6mr_multiaddr = in6a_site_allrouters;
- if (mcastif) {
- if ((mreq.ipv6mr_interface = if_nametoindex(mcastif))
- == 0) {
- log_warn("invalid interface: %s", mcastif);
- exit(1);
- }
- } else
- mreq.ipv6mr_interface = ra->ifindex;
- if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq,
- sizeof(mreq)) < 0) {
- log_warn("IPV6_JOIN_GROUP(site) on %s", mcastif ?
- mcastif : ra->ifname);
- exit(1);
- }
- }
-
/* initialize msghdr for receiving packets */
rcviov[0].iov_base = (caddr_t)answer;
rcviov[0].iov_len = sizeof(answer);