rtadvd: Add C flag to control the zeroing of the leaving configuration

This is only intended to assist the testing of clients which consume
Router Advertisement messages, such as dhcpcd(8).
This commit is contained in:
roy 2019-11-11 13:42:49 +00:00
parent 5952ea0ef1
commit 8a7de48817
4 changed files with 24 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.c,v 1.42 2019/11/10 21:32:38 roy Exp $ */
/* $NetBSD: config.c,v 1.43 2019/11/11 13:42:49 roy Exp $ */
/* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */
/*
@ -719,6 +719,11 @@ getconfig(const char *intface, int exithard)
TAILQ_FOREACH(rai, &ralist, next) {
if (rai->ifindex == tmp->ifindex) {
TAILQ_REMOVE(&ralist, rai, next);
if (Cflag) {
free_rainfo(rai);
rai = NULL;
break;
}
/* If we already have a leaving RA use that
* as this config hasn't been advertised */
if (rai->leaving) {

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rtadvd.8,v 1.26 2017/11/06 15:15:04 christos Exp $
.\" $NetBSD: rtadvd.8,v 1.27 2019/11/11 13:42:49 roy Exp $
.\" $KAME: rtadvd.8,v 1.24 2002/05/31 16:16:08 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 November 6, 2017
.Dd November 11, 2019
.Dt RTADVD 8
.Os
.Sh NAME
@ -36,7 +36,7 @@
.Nd router advertisement daemon
.Sh SYNOPSIS
.Nm
.Op Fl DdfRs
.Op Fl CDdfRs
.Op Fl c Ar configfile
.Op Fl M Ar ifname
.Op Fl p Ar pidfile
@ -112,6 +112,10 @@ advertising interface.
The command line options are:
.Bl -tag -width indent
.\"
.It Fl C
Don't expire the existing configuration on receipt of SIGHUP.
This option is only intended to aid the testing of clients that consume
Router Advertisement messages.
.It Fl c Ar configfile
Specify an alternate location,
.Ar configfile ,
@ -175,7 +179,9 @@ to reload the configuration file
.Pa /etc/rtadvd.conf .
If an invalid parameter is found in the configuration file upon the reload, the
entry will be ignored and the old configuration will be used.
When parameters in an existing entry are updated,
When parameters in an existing entry are updated and the
.Fl C
flag is not used,
.Nm
will send Router Advertisement messages with the old configuration but zero
router lifetime to the interface first, and then start to send a new message.

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtadvd.c,v 1.70 2019/11/10 21:07:39 roy Exp $ */
/* $NetBSD: rtadvd.c,v 1.71 2019/11/11 13:42:49 roy Exp $ */
/* $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $ */
/*
@ -89,7 +89,7 @@ static char *mcastif;
int sock;
int rtsock = -1;
int accept_rr = 0;
int dflag = 0, sflag = 0, Dflag;
int Cflag = 0, dflag = 0, sflag = 0, Dflag;
static char **if_argv;
static int if_argc;
@ -194,6 +194,9 @@ main(int argc, char *argv[])
case 'c':
conffile = optarg;
break;
case 'C':
Cflag++;
break;
case 'd':
dflag++;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtadvd.h,v 1.19 2018/04/20 16:37:17 roy Exp $ */
/* $NetBSD: rtadvd.h,v 1.20 2019/11/11 13:42:49 roy Exp $ */
/* $KAME: rtadvd.h,v 1.30 2005/10/17 14:40:02 suz Exp $ */
/*
@ -197,3 +197,5 @@ void ra_timer_set_short_delay(struct rainfo *, struct rtadvd_timer *);
int prefix_match(struct in6_addr *, int, struct in6_addr *, int);
struct rainfo *if_indextorainfo(unsigned int);
struct prefix *find_prefix(struct rainfo *, struct in6_addr *, int);
extern int Cflag;