Source-Changes-HG archive

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

[src/trunk]: src Remove rtsol(8) and rtsold(8) as their functionality is in d...



details:   https://anonhg.NetBSD.org/src/rev/f48048d7fad4
branches:  trunk
changeset: 332210:f48048d7fad4
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Sep 11 13:10:03 2014 +0000

description:
Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@

diffstat:

 distrib/sets/lists/base/mi       |    6 +-
 doc/CHANGES                      |    4 +-
 etc/defaults/rc.conf             |    3 +-
 etc/rc.d/network                 |   39 +-
 etc/rc.d/rtsold                  |   26 -
 rescue/list.inet6                |    3 +-
 sbin/Makefile                    |    4 +-
 sbin/ifconfig/ifconfig.8         |   16 +-
 sbin/ifconfig/ifconfig.c         |  106 +++++-
 sbin/rtsol/Makefile              |   19 -
 usr.sbin/postinstall/postinstall |    4 +-
 usr.sbin/rtsold/Makefile         |   13 +-
 usr.sbin/rtsold/dump.c           |  146 -------
 usr.sbin/rtsold/if.c             |  366 -------------------
 usr.sbin/rtsold/probe.c          |  182 ---------
 usr.sbin/rtsold/rtsock.c         |  175 ---------
 usr.sbin/rtsold/rtsol.c          |  346 ------------------
 usr.sbin/rtsold/rtsold.8         |  185 +---------
 usr.sbin/rtsold/rtsold.c         |  749 ---------------------------------------
 usr.sbin/rtsold/rtsold.h         |  100 -----
 20 files changed, 146 insertions(+), 2346 deletions(-)

diffs (truncated from 2773 to 300 lines):

diff -r ccabbc5bb91f -r f48048d7fad4 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Thu Sep 11 11:14:44 2014 +0000
+++ b/distrib/sets/lists/base/mi        Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1088 2014/08/22 10:51:38 apb Exp $
+# $NetBSD: mi,v 1.1089 2014/09/11 13:10:03 roy Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -359,7 +359,7 @@
 ./sbin/route                                   base-netutil-root
 ./sbin/routed                                  base-router-root
 ./sbin/rrestore                                        base-netutil-root
-./sbin/rtsol                                   base-netutil-root       use_inet6
+./sbin/rtsol                                   base-obsolete           obsolete
 ./sbin/rump.cgdconfig                          base-sysutil-root       crypto,rump
 ./sbin/rump.ifconfig                           base-netutil-root       rump
 ./sbin/rump.modload                            base-sysutil-root       rump
@@ -1631,7 +1631,7 @@
 ./usr/sbin/rpcbind                             base-rpcbind-bin
 ./usr/sbin/rtadvd                              base-router-bin         use_inet6
 ./usr/sbin/rtquery                             base-netutil-bin
-./usr/sbin/rtsold                              base-netutil-bin        inet6
+./usr/sbin/rtsold                              base-obsolete           obsolete
 ./usr/sbin/rump.envstat                                base-sysutil-bin        rump
 ./usr/sbin/rump.powerd                         base-sysutil-bin        rump
 ./usr/sbin/rump.traceroute                     base-netutil-bin        rump
diff -r ccabbc5bb91f -r f48048d7fad4 doc/CHANGES
--- a/doc/CHANGES       Thu Sep 11 11:14:44 2014 +0000
+++ b/doc/CHANGES       Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.1978 $>
+# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.1979 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -46,3 +46,5 @@
        awinrtc(4): Add support for AllWinner A10/A20 real-time clock.
                [jmcneill 20140907]
        awinmmc(4): Use DMA for MMC transfers. [jmcneill 20140908]
+       rtsol(8): Removed in favour of dhcpcd. [roy 20140911]
+       rtsold(8): Removed in favour of dhcpcd. [roy 20140911]
diff -r ccabbc5bb91f -r f48048d7fad4 etc/defaults/rc.conf
--- a/etc/defaults/rc.conf      Thu Sep 11 11:14:44 2014 +0000
+++ b/etc/defaults/rc.conf      Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.123 2014/07/22 17:11:09 wiz Exp $
+#      $NetBSD: rc.conf,v 1.124 2014/09/11 13:10:03 roy Exp $
 #
 # /etc/defaults/rc.conf --
 #      default configuration of /etc/rc.conf
@@ -253,7 +253,6 @@
 gated=NO
 mrouted=NO             mrouted_flags=""
 route6d=NO             route6d_flags=""
-rtsold=NO              rtsold_flags="-a"       # for ip6mode=autohost only
 ldpd=NO
 
 # Daemons used to boot other hosts over a network.
diff -r ccabbc5bb91f -r f48048d7fad4 etc/rc.d/network
--- a/etc/rc.d/network  Thu Sep 11 11:14:44 2014 +0000
+++ b/etc/rc.d/network  Thu Sep 11 13:10:03 2014 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.66 2014/04/29 09:58:18 uebayasi Exp $
+# $NetBSD: network,v 1.67 2014/09/11 13:10:03 roy Exp $
 #
 
 # PROVIDE: network
@@ -432,33 +432,26 @@
 network_start_ipv6_autoconf()
 {
        # IPv6 interface autoconfiguration.
-       #
-       # wait till DAD is completed. always invoke it in case
-       # if are configured manually by ifconfig
-       #
-       echo 'Waiting for DAD completion for' \
-           'statically configured addresses...'
+
        dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null)
-       sleep $dadcount
-       sleep 1
+       if [ -n "$dadcount" -a "$dadcount" != 0 ]; then
+               # wait till DAD is completed
+               echo 'Waiting for DAD to complete for' \
+                   'statically configured addresses...'
+               # Add 1 for MAX_RTR_SOLICITATION_DELAY and another
+               # to give time for the last DAD packet to respond and
+               # a few more for luck.
+               waitsecs=$((dadcount + 4))
+               /sbin/ifconfig -w $waitsecs
+       fi
 
-       if checkyesno rtsol; then
+       # dhcpcd will ensure DAD completes before forking
+       if checkyesno rtsol && !checkyesno dhcpcd; then
                if [ "$ip6mode" = "autohost" ]; then
-                       echo 'Sending router solicitation...'
-                       /sbin/rtsol $rtsol_flags
-               else
                        echo
-                       warn \
-                   "ip6mode must be set to 'autohost' to use rtsol."
+                       warn "rtsol has been removed, " \
+                           "please configure dhcpcd in its place."
                fi
-
-               # wait till DAD is completed, for global addresses
-               # configured by router advert message.
-               #
-               echo 'Waiting for DAD completion for' \
-                   'addresses configured by router advert message...'
-               sleep $dadcount
-               sleep 1
        fi
 }
 
diff -r ccabbc5bb91f -r f48048d7fad4 etc/rc.d/rtsold
--- a/etc/rc.d/rtsold   Thu Sep 11 11:14:44 2014 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: rtsold,v 1.7 2006/10/07 21:41:41 rpaulo Exp $
-#
-
-# PROVIDE: rtsold
-# REQUIRE: network mountcritlocal
-# BEFORE:  NETWORKING
-
-$_rc_subr_loaded . /etc/rc.subr
-
-name="rtsold"
-rcvar=$name
-command="/usr/sbin/${name}"
-start_precmd="rtsold_precmd"
-
-rtsold_precmd()
-{
-       if [ "$ip6mode" != "autohost" ]; then
-               warn "\$ip6mode must be set to 'autohost' to use ${name}."
-               return 1
-       fi
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff -r ccabbc5bb91f -r f48048d7fad4 rescue/list.inet6
--- a/rescue/list.inet6 Thu Sep 11 11:14:44 2014 +0000
+++ b/rescue/list.inet6 Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,3 @@
-#      $NetBSD: list.inet6,v 1.1 2005/01/10 02:58:59 lukem Exp $
+#      $NetBSD: list.inet6,v 1.2 2014/09/11 13:10:03 roy Exp $
 
 PROG   ping6
-PROG   rtsol
diff -r ccabbc5bb91f -r f48048d7fad4 sbin/Makefile
--- a/sbin/Makefile     Thu Sep 11 11:14:44 2014 +0000
+++ b/sbin/Makefile     Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.126 2013/12/25 22:04:52 christos Exp $
+#      $NetBSD: Makefile,v 1.127 2014/09/11 13:10:03 roy Exp $
 #      @(#)Makefile    8.5 (Berkeley) 3/31/94
 
 # Not ported: XNSrouted enpload scsiformat startslip
@@ -55,7 +55,7 @@
 .endif
 
 .if (${USE_INET6} != "no")
-SUBDIR+= ping6 rtsol
+SUBDIR+= ping6
 .endif
 
 .if (${MKISCSI} != "no")
diff -r ccabbc5bb91f -r f48048d7fad4 sbin/ifconfig/ifconfig.8
--- a/sbin/ifconfig/ifconfig.8  Thu Sep 11 11:14:44 2014 +0000
+++ b/sbin/ifconfig/ifconfig.8  Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ifconfig.8,v 1.106 2014/01/07 20:25:24 degroote Exp $
+.\"    $NetBSD: ifconfig.8,v 1.107 2014/09/11 13:10:04 roy Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -59,6 +59,9 @@
 .Fl s
 .Ar interface
 .Nm
+.Fl w
+.Ar secs
+.Nm
 .Fl C
 .Sh DESCRIPTION
 .Nm
@@ -860,6 +863,17 @@
 after printing them.
 .Pp
 The
+.Fl w
+flag may be used to wait
+.Ar seconds
+seconds for the
+.Cm tentative
+flag to be removed from all addresses.
+0 seconds means to wait indefinitely until all addresses no longer have the
+.Cm tentative
+flag.
+.Pp
+The
 .Fl N
 flag is just the opposite of the
 .Fl n
diff -r ccabbc5bb91f -r f48048d7fad4 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Thu Sep 11 11:14:44 2014 +0000
+++ b/sbin/ifconfig/ifconfig.c  Thu Sep 11 13:10:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.231 2013/10/19 00:35:30 christos Exp $  */
+/*     $NetBSD: ifconfig.c,v 1.232 2014/09/11 13:10:04 roy Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.231 2013/10/19 00:35:30 christos Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.232 2014/09/11 13:10:04 roy Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -102,10 +102,13 @@
 #include "env.h"
 #include "prog_ops.h"
 
-static bool bflag, dflag, hflag, sflag, uflag;
+#define WAIT_DAD       10000000 /* nanoseconds between each poll, 10ms */
+
+static bool bflag, dflag, hflag, sflag, uflag, wflag;
 bool lflag, Nflag, vflag, zflag;
+static long wflag_secs;
 
-static char gflags[10 + 26 * 2 + 1] = "AabCdhlNsuvz";
+static char gflags[10 + 26 * 2 + 1] = "AabCdhlNsuvw:z";
 bool gflagset[10 + 26 * 2];
 
 static int carrier(prop_dictionary_t);
@@ -115,6 +118,7 @@
 static void init_afs(void);
 static int list_cloners(prop_dictionary_t, prop_dictionary_t);
 static int media_status_exec(prop_dictionary_t, prop_dictionary_t);
+static int wait_dad_exec(prop_dictionary_t, prop_dictionary_t);
 static int no_cmds_exec(prop_dictionary_t, prop_dictionary_t);
 static int notrailers(prop_dictionary_t, prop_dictionary_t);
 static void printall(const char *, prop_dictionary_t);
@@ -223,6 +227,9 @@
 struct pterm cloneterm = PTERM_INITIALIZER(&cloneterm, "list cloners",
     list_cloners, "none");
 
+struct pterm wait_dad = PTERM_INITIALIZER(&wait_dad, "wait DAD", wait_dad_exec,
+    "none");
+
 struct pterm no_cmds = PTERM_INITIALIZER(&no_cmds, "no commands", no_cmds_exec,
     "none");
 
@@ -506,6 +513,70 @@
 }
 
 static int
+wait_dad_exec(prop_dictionary_t env, prop_dictionary_t oenv)
+{
+#ifdef INET6
+       bool waiting;
+       struct ifaddrs *ifaddrs, *ifa;
+       struct in6_ifreq ifr6;
+       int s;
+       const struct timespec ts = { .tv_sec = 0, .tv_nsec = WAIT_DAD };
+       const struct timespec add = { .tv_sec = wflag_secs, .tv_nsec = 0};
+       struct timespec now, end;
+
+       if (wflag_secs) {
+               if (clock_gettime(CLOCK_MONOTONIC, &now) == -1)
+                       err(EXIT_FAILURE, "clock_gettime");
+               timespecadd(&now, &add, &end);
+       }
+
+       if (getifaddrs(&ifaddrs) == -1)
+               err(EXIT_FAILURE, "getifaddrs");
+
+       for (;;) {
+               waiting = false;
+               for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) {
+                       if (ifa->ifa_addr == NULL)
+                               continue;
+                       switch (ifa->ifa_addr->sa_family) {
+                       case AF_INET6:
+                               memset(&ifr6, 0, sizeof(ifr6));
+                               strncpy(ifr6.ifr_name,
+                                   ifa->ifa_name, sizeof(ifr6.ifr_name));
+                               ifr6.ifr_addr =



Home | Main Index | Thread Index | Old Index