summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2005-09-10 17:05:04 +0000
committerBrooks Davis <brooks@FreeBSD.org>2005-09-10 17:05:04 +0000
commit2451497381d65d887b5f27616f5d2cd68bd93ae9 (patch)
tree29de59b1a3bf1f014fb58f70b589008d06326a9f /etc
parentebd0446134ce51289583f9d2eb02bd438aa3867b (diff)
Notes
Diffstat (limited to 'etc')
-rw-r--r--etc/network.subr51
-rwxr-xr-xetc/pccard_ether4
-rw-r--r--etc/rc.d/netif8
3 files changed, 49 insertions, 14 deletions
diff --git a/etc/network.subr b/etc/network.subr
index b54cdbb41509..d5a1703670e5 100644
--- a/etc/network.subr
+++ b/etc/network.subr
@@ -43,16 +43,23 @@ ifconfig_up()
ifconfig_args=`ifconfig_getargs $1`
if [ -n "${ifconfig_args}" ]; then
- ifconfig $1 ${ifconfig_args}
+ ifconfig $1 up
+ eval "ifconfig $1 ${ifconfig_args}"
_cfg=0
fi
if wpaif $1; then
+ if [ $_cfg -ne 0 ] ; then
+ ifconfig $1 up
+ fi
/etc/rc.d/wpa_supplicant start $1
_cfg=0 # XXX: not sure this should count
fi
if dhcpif $1; then
+ if [ $_cfg -ne 0 ] ; then
+ ifconfig $1 up
+ fi
/etc/rc.d/dhclient start $1
_cfg=0
fi
@@ -112,10 +119,7 @@ _ifconfig_getargs()
return 1
fi
- eval _args=\$ifconfig_$1
- if [ -z "$_args" ]; then
- _args=$ifconfig_DEFAULT
- fi
+ eval _args=\${ifconfig_$1-$ifconfig_DEFAULT}
echo "$_args"
}
@@ -135,6 +139,8 @@ ifconfig_getargs()
case $_arg in
[Dd][Hh][Cc][Pp])
;;
+ [Nn][Oo][Aa][Uu][Tt][Oo])
+ ;;
[Ww][Pp][Aa])
;;
*)
@@ -146,6 +152,22 @@ ifconfig_getargs()
echo $_args
}
+# autoif
+# Returns 0 if the interface should be automaticly configured at
+# boot time and 1 otherwise.
+autoif()
+{
+ _tmpargs=`_ifconfig_getargs $1`
+ for _arg in $_tmpargs; do
+ case $_arg in
+ [Nn][Oo][Aa][Uu][Tt][Oo])
+ return 1
+ ;;
+ esac
+ done
+ return 0
+}
+
# dhcpif if
# Returns 0 if the interface is a DHCP interface and 1 otherwise.
dhcpif()
@@ -382,14 +404,27 @@ list_net_interfaces()
{
type=$1
- # Get a list of ALL the interfaces
+ # Get a list of ALL the interfaces and make lo0 first if it's there.
#
case ${network_interfaces} in
[Aa][Uu][Tt][Oo])
- _tmplist="`ifconfig -l`"
+ _prefix=''
+ _autolist="`ifconfig -l`"
+ _lo=
+ for _if in ${_autolist} ; do
+ if autoif $_if; then
+ if [ "$_if" = "lo0" ]; then
+ _lo="lo0 "
+ else
+ _tmplist="${_tmplist}${_prefix}${_if}"
+ [ -z "$_prefix" ] && _prefix=' '
+ fi
+ fi
+ done
+ _tmplist="${_lo}${_tmplist}"
;;
*)
- _tmplist="${network_interfaces} ${removable_interfaces} ${cloned_interfaces}"
+ _tmplist="${network_interfaces} ${cloned_interfaces}"
;;
esac
diff --git a/etc/pccard_ether b/etc/pccard_ether
index d75205508ded..04c6f76f6616 100755
--- a/etc/pccard_ether
+++ b/etc/pccard_ether
@@ -61,8 +61,8 @@ shift
load_rc_config pccard_ether
-# Ignore interfaces not in removable_interfaces
-expr "${removable_interfaces}" : ".*${ifn}" > /dev/null || exit 0
+# Ignore interfaces with the NOAUTO keyword
+autoif $ifn || exit 0
if [ -n "$1" ]; then
usage
diff --git a/etc/rc.d/netif b/etc/rc.d/netif
index bad471b0994b..b692ee3e7fc5 100644
--- a/etc/rc.d/netif
+++ b/etc/rc.d/netif
@@ -51,6 +51,9 @@ network_start()
# We're operating as a general network start routine.
#
+ # disable SIGINT (Ctrl-c) when running at startup
+ trap : 2
+
# Create cloned interfaces
clone_up
@@ -102,9 +105,6 @@ network_common()
fi
[ -n "$2" ] && _verbose=yes
- # Get a list of network interfaces.
- _ifn_list="`list_net_interfaces`"
-
# Set the scope of the command (all interfaces or just one).
#
_cooked_list=
@@ -114,7 +114,7 @@ network_common()
# kill off wpa_supplicant.
_cooked_list="$_cmdifn"
else
- _cooked_list="$_ifn_list"
+ _cooked_list="`list_net_interfaces`"
fi
for ifn in ${_cooked_list}; do