Source-Changes-HG archive

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

[src/trunk]: src change IPv6 configuration syntax to avoid ambiguity.



details:   https://anonhg.NetBSD.org/src/rev/e495a228b61f
branches:  trunk
changeset: 481756:e495a228b61f
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Feb 05 17:02:42 2000 +0000

description:
change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.

diffstat:

 etc/netstart             |  49 +++++++++++++++++++++++++++++++++++++----------
 etc/rc                   |  11 +++++----
 etc/rc.conf              |   8 +++---
 share/man/man5/rc.conf.5 |  41 +++++++++++++++++++++++++--------------
 4 files changed, 74 insertions(+), 35 deletions(-)

diffs (200 lines):

diff -r eae4ca4512a4 -r e495a228b61f etc/netstart
--- a/etc/netstart      Sat Feb 05 14:35:41 2000 +0000
+++ b/etc/netstart      Sat Feb 05 17:02:42 2000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#      $NetBSD: netstart,v 1.69 2000/01/26 07:01:53 explorer Exp $
+#      $NetBSD: netstart,v 1.70 2000/02/05 17:02:42 itojun Exp $
 #      from: @(#)netstart      8.1 (Berkeley) 7/23/93
 
 if [ -f /etc/rc.subr ]; then
@@ -211,19 +211,46 @@
        route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
        route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
 
-       sysctl -w net.inet6.ip6.forwarding=0
-       sysctl -w net.inet6.ip6.accept_rtadv=0
-       if checkyesno ip6forwarding; then
-               if checkyesno rtsol; then
-                       echo "WARNING: rtsol cannot be used on IPv6 router."
+       sysctl -w net.inet6.ip6.forwarding=0 >/dev/null
+       sysctl -w net.inet6.ip6.accept_rtadv=0 >/dev/null
+
+       # backward compatibility
+       if test "x$ip6mode" = "x" -a "x$ip6forwarding" != "x"; then
+               echo 'WARNING: please migrate to newer rc.conf' \
+                   '(use ip6mode, not ip6forwarding)'
+               if checkyesno ip6forwarding; then
+                       ip6mode=router
                else
-                       sysctl -w net.inet6.ip6.forwarding=1
+                       if checkyesno rtsol; then
+                               ip6mode=autohost
+                       else
+                               ip6mode=host
+                       fi
                fi
-       else
-               if checkyesno rtsol; then
-                       echo -n "sending IPv6 router solicitation...";
-                       sysctl -w net.inet6.ip6.accept_rtadv=1
+       fi
+
+       case $ip6mode in
+       router) echo 'IPv6 mode: router'
+               sysctl -w net.inet6.ip6.forwarding=1 >/dev/null
+               ;;
+       autohost)
+               echo 'IPv6 mode: autoconfigured host'
+               sysctl -w net.inet6.ip6.accept_rtadv=1 >/dev/null
+               ;;
+       host)   echo 'IPv6 mode: host'
+               ;;
+       *)      echo 'WARNING: invalid value in ip6mode'
+               ;;
+       esac
+
+       if checkyesno rtsol; then
+               if test "x$ip6mode" = "xautohost"; then
+                       echo 'Sending router solicitation...'
                        rtsol $rtsol_flags
+               else
+                       echo
+                       logger -s "WARNING: ip6mode must be set to autohost" \
+                           "to use rtsol."
                fi
        fi
 
diff -r eae4ca4512a4 -r e495a228b61f etc/rc
--- a/etc/rc    Sat Feb 05 14:35:41 2000 +0000
+++ b/etc/rc    Sat Feb 05 17:02:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc,v 1.145 2000/01/31 12:47:29 jdc Exp $
+#      $NetBSD: rc,v 1.146 2000/02/05 17:02:42 itojun Exp $
 #      originally from: @(#)rc 8.2 (Berkeley) 3/17/94
 
 # System startup script run by init on autoboot
@@ -503,11 +503,12 @@
 fi
 
 if checkyesno rtsold; then
-       if checkyesno ip6forwarding; then
+       if test "x$ip6mode" = "xautohost"; then
+               echo -n ' rtsold';      rtsold $rtsold_flags
+       else
                echo
-               logger -s "WARNING: rtsold cannot be used on IPv6 router."
-       else
-               echo -n ' rtsold';      rtsold $rtsold_flags
+               logger -s "WARNING: ip6mode must be set to autohost" \
+                   "to use rtsold."
        fi
 fi
 
diff -r eae4ca4512a4 -r e495a228b61f etc/rc.conf
--- a/etc/rc.conf       Sat Feb 05 14:35:41 2000 +0000
+++ b/etc/rc.conf       Sat Feb 05 17:02:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.71 2000/01/28 06:55:52 fair Exp $
+#      $NetBSD: rc.conf,v 1.72 2000/02/05 17:02:43 itojun Exp $
 #
 # see rc.conf(5) for more information.
 
@@ -68,8 +68,8 @@
 dhclient_flags=""                              # blank: config all interfaces
 ntpdate=NO             ntpdate_hosts=""        # blank: hosts in /etc/ntp.conf
 ppp_peers=""                                   # /etc/ppp/peers to call
-ip6forwarding="NO"                             # IPv6 router
-rtsol="NO"             rtsol_flags=""          # IPv6 autoconf (on non-router)
+ip6mode=host                                   # host, autohost or router
+rtsol=NO               rtsol_flags=""          # for ip6mode=autohost only
 
 # Daemons required by servers.  These are not needed for strictly client use.
 # inetd is used to start many IP-based services.
@@ -91,7 +91,7 @@
 gated=NO               gated_flags=""
 mrouted=NO             mrouted_flags=""
 route6d=NO             route6d_flags=""
-rtsold=NO              rtsold_flags=""         # not really routing daemon...
+rtsold=NO              rtsold_flags=""         # for ip6mode=autohost only
 
 # Daemons used to boot other hosts over a network
 rarpd=NO               rarpd_flags="-a"
diff -r eae4ca4512a4 -r e495a228b61f share/man/man5/rc.conf.5
--- a/share/man/man5/rc.conf.5  Sat Feb 05 14:35:41 2000 +0000
+++ b/share/man/man5/rc.conf.5  Sat Feb 05 17:02:42 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rc.conf.5,v 1.28 1999/11/29 01:40:34 itojun Exp $
+.\"    $NetBSD: rc.conf.5,v 1.29 2000/02/05 17:02:44 itojun Exp $
 .\"
 .\" Copyright (c) 1996 Matthew R. Green
 .\" Copyright (c) 1997 Curt J. Sampson
@@ -294,32 +294,43 @@
 with the
 .Dq call Sy peer
 option.
-.It Sy ip6forwarding
-YES or NO.
+.It Sy ip6mode
 An IPv6 node can be a router
 .Pq nodes that forward packet for others
 or host
 .Pq nodes that do not forward .
+A host can be autoconfigured
+based on the information advertised by adjacent IPv6 router.
 By setting
-.Sy ip6forwarding
-to YES, the node will become an IPv6 router.
-Note that this is orthogonal to IPv4 forwarding/routing.
+.Sy ip6mode
+to
+.Dq Li router ,
+.Dq Li host ,
+or
+.Dq Li autohost ,
+you can configure your node as a router,
+a non-autoconfigured host, or an autoconfigured host.
+Invalid values will be ignored, and the node will be configured as
+a non-autoconfigured host.
+You may want to check
+.Sy rtsol
+and
+.Sy rtsold
+as well, if you set the variable to
+.Li autohost .
 .It Sy rtsol
 YES or NO.
 Run
 .Xr rtsol 8 ,
 router solicitation command for IPv6 host.
-By setting this option to YES, your host will be autoconfigured
-based on the information advertised by adjacent IPv6 router.
 On nomadic host like notebook computers, you may want to enable
 .Sy rtsold
 as well.
 Passes
 .Sy rtsol_flags .
-This is only for IPv6 host, so set
-.Sy ip6forwarding
-to NO if you use
-.Sy rtsol .
+This is only for autoconfigured IPv6 host, so set
+.Sy ip6mode
+to autohost if you use it.
 .El
 .Pp
 .Ss Daemons required by other daemons:
@@ -465,9 +476,9 @@
 only.
 Passes
 .Sy rtsold_flags .
-This is only for IPv6 host, so set
-.Sy ip6forwarding
-to NO if you use it.
+This is only for autoconfigured IPv6 host, so set
+.Sy ip6mode
+to autohost if you use it.
 .El
 .Pp
 .Ss Daemons used to boot other hosts over a network:



Home | Main Index | Thread Index | Old Index