Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src extend /etc/ifconfig.xxN, for comment lines (#) and shell sc...
details: https://anonhg.NetBSD.org/src/rev/e51756a83359
branches: trunk
changeset: 502095:e51756a83359
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Jan 11 17:56:16 2001 +0000
description:
extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.
diffstat:
distrib/sets/lists/man/mi | 4 +-
etc/rc.d/network | 16 +++++-
share/man/man5/Makefile | 5 +-
share/man/man5/ifconfig.if.5 | 104 +++++++++++++++++++++++++++++++++++++++++++
share/man/man5/rc.conf.5 | 13 +++-
5 files changed, 133 insertions(+), 9 deletions(-)
diffs (232 lines):
diff -r 02861e0dda32 -r e51756a83359 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Thu Jan 11 16:37:41 2001 +0000
+++ b/distrib/sets/lists/man/mi Thu Jan 11 17:56:16 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.302 2001/01/11 06:11:29 augustss Exp $
+# $NetBSD: mi,v 1.303 2001/01/11 17:56:17 itojun Exp $
./usr/share/info/am-utils.info
./usr/share/info/as.info
./usr/share/info/awk.info
@@ -959,6 +959,7 @@
./usr/share/man/cat5/hosts_access.0
./usr/share/man/cat5/hosts_options.0
./usr/share/man/cat5/ifaliases.0
+./usr/share/man/cat5/ifconfig.if.0
./usr/share/man/cat5/inetd.conf.0
./usr/share/man/cat5/inode.0
./usr/share/man/cat5/intro.0
@@ -2423,6 +2424,7 @@
./usr/share/man/man5/hosts_access.5
./usr/share/man/man5/hosts_options.5
./usr/share/man/man5/ifaliases.5
+./usr/share/man/man5/ifconfig.if.5
./usr/share/man/man5/inetd.conf.5
./usr/share/man/man5/inode.5
./usr/share/man/man5/intro.5
diff -r 02861e0dda32 -r e51756a83359 etc/rc.d/network
--- a/etc/rc.d/network Thu Jan 11 16:37:41 2001 +0000
+++ b/etc/rc.d/network Thu Jan 11 17:56:16 2001 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: network,v 1.28 2001/01/03 17:54:05 itojun Exp $
+# $NetBSD: network,v 1.29 2001/01/11 17:56:16 itojun Exp $
#
# PROVIDE: network
@@ -88,6 +88,9 @@
# inet 10.1.1.2 netmask 0xffffff00 alias
# inet6 fec0::1 prefixlen 64 alias
#
+ # You can put shell script fragment into /etc/ifconfig.xxN by
+ # starting a line with "!". Refer to ifconfig.if(5) for details.
+ #
if [ "$net_interfaces" != NO ]; then
if checkyesno auto_ifconfig; then
tmp=`ifconfig -l`
@@ -110,7 +113,16 @@
echo -n " $int"
while read args; do
[ -z "$args" ] && continue
- ifconfig $int $args
+ case "$args" in
+ "#"*)
+ ;;
+ "!"*)
+ eval ${args#*!}
+ ;;
+ *)
+ ifconfig $int $args
+ ;;
+ esac
done < /etc/ifconfig.$int
else
if ! checkyesno auto_ifconfig; then
diff -r 02861e0dda32 -r e51756a83359 share/man/man5/Makefile
--- a/share/man/man5/Makefile Thu Jan 11 16:37:41 2001 +0000
+++ b/share/man/man5/Makefile Thu Jan 11 17:56:16 2001 +0000
@@ -1,11 +1,12 @@
-# $NetBSD: Makefile,v 1.35 2000/09/13 03:39:13 hubertf Exp $
+# $NetBSD: Makefile,v 1.36 2001/01/11 17:56:16 itojun Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# missing: dump.5 plot.5
MAN= a.out.5 acct.5 ar.5 core.5 daily.conf.5 dir.5 disktab.5 ethers.5 fs.5 \
fstab.5 genassym.cf.5 group.5 hesiod.conf.5 hosts.5 hosts.equiv.5 \
- ifaliases.5 intro.5 ld.so.conf.5 link.5 lkm.conf.5 login.conf.5 \
+ ifaliases.5 ifconfig.if.5 intro.5 ld.so.conf.5 link.5 lkm.conf.5 \
+ login.conf.5 \
mk.conf.5 monthly.conf.5 motd.5 netconfig.5 netgroup.5 networks.5 \
nsswitch.conf.5 passwd.5 passwd.conf.5 \
phones.5 printcap.5 protocols.5 ranlib.5 rc.conf.5 remote.5 \
diff -r 02861e0dda32 -r e51756a83359 share/man/man5/ifconfig.if.5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man5/ifconfig.if.5 Thu Jan 11 17:56:16 2001 +0000
@@ -0,0 +1,104 @@
+.\" $NetBSD: ifconfig.if.5,v 1.1 2001/01/11 17:56:16 itojun Exp $
+.\"
+.\" Copyright (c) 1996 Matthew R. Green
+.\" 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. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+.\"
+.Dd January 12, 2001
+.Dt IFCONFIG.IF 5
+.Os
+.Sh NAME
+.Nm ifconfig.if
+.Nd interface-specific configuration files
+.Sh DESCRIPTION
+The
+.Nm
+files contain information regarding the configuration of each network interface.
+.Nm
+is processed by
+.Pa /etc/rc.d/network
+at system boot time, if the interface exists on the system.
+.Pp
+One file should exist for each interface that is to be configured, such as
+.Pa ifconfig.fxp0 .
+Multiple lines can be placed in a file, and will be evaluated sequentially.
+.Pp
+Normally, a line will be evaluated as
+.Xr ifconfig 8
+command parameter.
+.Dq Li ifconfig if
+will be prepended on evaluation.
+.Pp
+If a line is empty, or starts with
+.Sq # ,
+the line will be ignored as comment.
+.Pp
+If a line starts with
+.Sq ! ,
+the rest of line will get evaluated as shell script fragment.
+Shell variables declared in
+.Pa /etc/rc.d/network
+are accessible.
+The most useful variable is
+.Li $int ,
+as it will be bound to the interface being configured with the file.
+.Pp
+For example, the following illustrates static interface configuration:
+.Bd -literal -offset xxxx
+# IPv4, with an alias
+inet 10.0.1.12 255.255.255.0 media 100baseTX
+inet 10.0.1.13 255.255.255.255 alias
+# let us have IPv6 address on this interface
+inet6 fec0::1 prefixlen 64 alias
+# have subnet router anycast address too
+inet6 fec0:: prefixlen 64 alias anycast
+.Ed
+.Pp
+The following illustrates dynamic configuration setup with
+.Xr dhclient 8
+and
+.Xr rtsol 8 :
+.Bd -literal -offset xxxx
+up
+# autoconfigure IPv4 address
+!dhclient $int
+# autoconfigure IPv6 address. be sure to set $ip6mode to autohost.
+!rtsol $int
+.Ed
+.Pp
+The following example is for dynamically-created pseudo interfaces like
+.Xr gif 4 :
+.Bd -literal -offset xxxx
+create
+up
+# configure IPv6 default route toward the interface
+!route add -inet6 default ::1
+!route change -inet6 default -ifp $int
+.Ed
+.Sh FILES
+.Pa /etc/rc.d/network
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr ifconfig 8
diff -r 02861e0dda32 -r e51756a83359 share/man/man5/rc.conf.5
--- a/share/man/man5/rc.conf.5 Thu Jan 11 16:37:41 2001 +0000
+++ b/share/man/man5/rc.conf.5 Thu Jan 11 17:56:16 2001 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: rc.conf.5,v 1.41 2001/01/03 17:54:05 itojun Exp $
+.\" $NetBSD: rc.conf.5,v 1.42 2001/01/11 17:56:17 itojun Exp $
.\"
.\" Copyright (c) 1996 Matthew R. Green
.\" Copyright (c) 1997 Curt J. Sampson
@@ -255,17 +255,21 @@
do not have an ifconfig file or variable.
.It Sy net_interfaces
The list of network interfaces to be configured at boot time.
-For each interface "xxn", the system first looks for ifconfig
+For each interface "xxN", the system first looks for ifconfig
parameters in
-.Pa /etc/ifconfig.xxn
+.Pa /etc/ifconfig.xxN
and then in the variable
-.Sy ifconfig_xxn .
+.Sy ifconfig_xxN .
The contents of the file or the variable are handed to ifconfig
after the interface name.
If
.Sy auto_ifconfig
is set to "NO" and neither the file nor the variable is found,
a warning is printed.
+Refer to
+.Xr ifconfig.if 5
+for more details on
+.Pa /etc/ifconfig.xxN .
.It Sy ifaliases_*
List of
.Sq Em "address netmask"
@@ -904,6 +908,7 @@
.Nm "" .
.El
.Sh SEE ALSO
+.Xr ifconfig.if 5 ,
.Xr boot 8 ,
.Xr rc 8 ,
.Xr sysctl 8
Home |
Main Index |
Thread Index |
Old Index