Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.sbin/rtadvd Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/65114f55fe94
branches:  netbsd-9
changeset: 1001110:65114f55fe94
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Nov 11 19:49:11 2019 +0000

description:
Pull up following revision(s) (requested by roy in ticket #417):

        usr.sbin/rtadvd/rtadvd.c: revision 1.70
        usr.sbin/rtadvd/rtadvd.c: revision 1.71
        usr.sbin/rtadvd/rtadvd.h: revision 1.20
        usr.sbin/rtadvd/config.c: revision 1.42
        usr.sbin/rtadvd/config.c: revision 1.43
        usr.sbin/rtadvd/rtadvd.8: revision 1.27

rtadvd: Fix reloading configuration killing interface timers

rtadvd: remove support for SIOCSIFINFO_IN6
It's been broken since we enabled dropping privs.
It's also probably the wrong place to do this, and support for
SIOCSIFINFO_IN6 will be in the next dhcpcd import.

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).

diffstat:

 usr.sbin/rtadvd/config.c |  35 ++++++-----------------------------
 usr.sbin/rtadvd/rtadvd.8 |  14 ++++++++++----
 usr.sbin/rtadvd/rtadvd.c |  33 +++++++++++++++++++--------------
 usr.sbin/rtadvd/rtadvd.h |   4 +++-
 4 files changed, 38 insertions(+), 48 deletions(-)

diffs (195 lines):

diff -r e884fc731dd8 -r 65114f55fe94 usr.sbin/rtadvd/config.c
--- a/usr.sbin/rtadvd/config.c  Mon Nov 11 17:21:11 2019 +0000
+++ b/usr.sbin/rtadvd/config.c  Mon Nov 11 19:49:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.c,v 1.41 2019/06/14 09:06:45 roy Exp $  */
+/*     $NetBSD: config.c,v 1.41.2.1 2019/11/11 19:49:11 martin Exp $   */
 /*     $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $    */
 
 /*
@@ -507,34 +507,6 @@
                goto errexit;
        }
 
-#ifdef SIOCSIFINFO_IN6
-       {
-               struct in6_ndireq ndi;
-               int s;
-
-               if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
-                       logit(LOG_ERR, "<%s> socket: %m", __func__);
-                       goto errexit;
-               }
-               memset(&ndi, 0, sizeof(ndi));
-               strncpy(ndi.ifname, intface, IFNAMSIZ);
-               if (prog_ioctl(s, SIOCGIFINFO_IN6, &ndi) < 0) {
-                       logit(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %m",
-                            __func__, intface);
-               }
-
-               /* reflect the RA info to the host variables in kernel */
-               ndi.ndi.chlim = tmp->hoplimit;
-               ndi.ndi.retrans = tmp->retranstimer;
-               ndi.ndi.basereachable = tmp->reachabletime;
-               if (prog_ioctl(s, SIOCSIFINFO_IN6, &ndi) < 0) {
-                       logit(LOG_INFO, "<%s> ioctl:SIOCSIFINFO_IN6 at %s: %m",
-                            __func__, intface);
-               }
-               prog_close(s);
-       }
-#endif
-
        /* route information */
        for (i = -1; i < MAXROUTE; i++) {
                struct rtinfo *rti;
@@ -747,6 +719,11 @@
        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) {
diff -r e884fc731dd8 -r 65114f55fe94 usr.sbin/rtadvd/rtadvd.8
--- a/usr.sbin/rtadvd/rtadvd.8  Mon Nov 11 17:21:11 2019 +0000
+++ b/usr.sbin/rtadvd/rtadvd.8  Mon Nov 11 19:49:11 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rtadvd.8,v 1.26 2017/11/06 15:15:04 christos Exp $
+.\"    $NetBSD: rtadvd.8,v 1.26.6.1 2019/11/11 19:49:11 martin 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 @@
 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 @@
 .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.
diff -r e884fc731dd8 -r 65114f55fe94 usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Mon Nov 11 17:21:11 2019 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Mon Nov 11 19:49:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtadvd.c,v 1.69 2019/03/29 21:51:52 christos Exp $     */
+/*     $NetBSD: rtadvd.c,v 1.69.2.1 2019/11/11 19:49:11 martin Exp $   */
 /*     $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $    */
 
 /*
@@ -89,7 +89,7 @@
 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 @@
                case 'c':
                        conffile = optarg;
                        break;
+               case 'C':
+                       Cflag++;
+                       break;
                case 'd':
                        dflag++;
                        break;
@@ -452,6 +455,18 @@
 }
 
 static void
+ra_timer_reset(struct rainfo *rai)
+{
+
+       rtadvd_remove_timer(&rai->timer);
+       rai->timer = rtadvd_add_timer(ra_timeout, ra_timer_update, rai, rai);
+       ra_timer_update(rai, &rai->timer->tm);
+       rtadvd_set_timer(&rai->timer->tm, rai->timer);
+       rtadvd_remove_timer(&rai->timer_sol);
+       rai->timer_sol = rtadvd_add_timer(ra_timeout_sol, NULL, rai, NULL);
+}
+
+static void
 rtmsg_input(void)
 {
        int n, type, ifindex = 0, plen;
@@ -698,14 +713,7 @@
 
                        rai->initcounter = 0; /* reset the counter */
                        rai->waiting = 0; /* XXX */
-                       rtadvd_remove_timer(&rai->timer);
-                       rai->timer = rtadvd_add_timer(ra_timeout,
-                           ra_timer_update, rai, rai);
-                       ra_timer_update(rai, &rai->timer->tm);
-                       rtadvd_set_timer(&rai->timer->tm, rai->timer);
-                       rtadvd_remove_timer(&rai->timer_sol);
-                       rai->timer_sol = rtadvd_add_timer(ra_timeout_sol,
-                           NULL, rai, NULL);
+                       ra_timer_reset(rai);
                } else if (prefixchange && rai->ifflags & IFF_UP) {
                        /*
                         * An advertised prefix has been added or invalidated.
@@ -1760,10 +1768,7 @@
                               "%s: expired RA,"
                               " new config active for interface (%s)",
                               __func__, rai->ifname);
-                       rai->leaving_for->timer = rtadvd_add_timer(ra_timeout,
-                           ra_timer_update,
-                           rai->leaving_for, rai->leaving_for);
-                       ra_timer_set_short_delay(rai->leaving_for, rai->timer);
+                       ra_timer_reset(rai->leaving_for);
                        rai->leaving_for->leaving = NULL;
                        free_rainfo(rai);
                        return NULL;
diff -r e884fc731dd8 -r 65114f55fe94 usr.sbin/rtadvd/rtadvd.h
--- a/usr.sbin/rtadvd/rtadvd.h  Mon Nov 11 17:21:11 2019 +0000
+++ b/usr.sbin/rtadvd/rtadvd.h  Mon Nov 11 19:49:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtadvd.h,v 1.19 2018/04/20 16:37:17 roy Exp $  */
+/*     $NetBSD: rtadvd.h,v 1.19.4.1 2019/11/11 19:49:11 martin Exp $   */
 /*     $KAME: rtadvd.h,v 1.30 2005/10/17 14:40:02 suz Exp $    */
 
 /*
@@ -197,3 +197,5 @@
 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;



Home | Main Index | Thread Index | Old Index