summaryrefslogtreecommitdiff
path: root/etc/network.subr
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2011-05-31 00:25:52 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2011-05-31 00:25:52 +0000
commit1dd53eaea333612bb3187e673a2bc5f7bd9c7e36 (patch)
treedaaf64b3c055004246c6fb2636cf669eb2e90cbd /etc/network.subr
parentb400f1ea974e59f725f545dab98d8ec8a355d3ff (diff)
downloadsrc-test2-1dd53eaea333612bb3187e673a2bc5f7bd9c7e36.tar.gz
src-test2-1dd53eaea333612bb3187e673a2bc5f7bd9c7e36.zip
Notes
Diffstat (limited to 'etc/network.subr')
-rw-r--r--etc/network.subr28
1 files changed, 20 insertions, 8 deletions
diff --git a/etc/network.subr b/etc/network.subr
index 8185c5a0c7c5..64fb0fe65bee 100644
--- a/etc/network.subr
+++ b/etc/network.subr
@@ -44,9 +44,9 @@ ifn_start()
ifscript_up ${ifn} && cfg=0
ifconfig_up ${ifn} && cfg=0
- ipv4_up ${ifn} && cfg=0
- ipv6_up ${ifn} && cfg=0
- ipx_up ${ifn} && cfg=0
+ afexists inet && ipv4_up ${ifn} && cfg=0
+ afexists inet6 && ipv6_up ${ifn} && cfg=0
+ afexists ipx && ipx_up ${ifn} && cfg=0
childif_create ${ifn} && cfg=0
return $cfg
@@ -64,9 +64,9 @@ ifn_stop()
[ -z "$ifn" ] && err 1 "ifn_stop called without an interface"
- ipx_down ${ifn} && cfg=0
- ipv6_down ${ifn} && cfg=0
- ipv4_down ${ifn} && cfg=0
+ afexists ipx && ipx_down ${ifn} && cfg=0
+ afexists inet6 && ipv6_down ${ifn} && cfg=0
+ afexists inet && ipv4_down ${ifn} && cfg=0
ifconfig_down ${ifn} && cfg=0
ifscript_down ${ifn} && cfg=0
childif_destroy ${ifn} && cfg=0
@@ -86,6 +86,11 @@ ifconfig_up()
local _cfg _ipv6_opts ifconfig_args
_cfg=1
+ # Make sure lo0 always comes up.
+ if [ "$1" = "lo0" ]; then
+ _cfg=0
+ fi
+
# ifconfig_IF
ifconfig_args=`ifconfig_getargs $1`
if [ -n "${ifconfig_args}" ]; then
@@ -351,10 +356,10 @@ afexists()
case ${_af} in
inet)
- ${SYSCTL_N} net.inet > /dev/null 2>&1
+ ${SYSCTL_N} kern.features.inet > /dev/null 2>&1
;;
inet6)
- ${SYSCTL_N} net.inet6 > /dev/null 2>&1
+ ${SYSCTL_N} kern.features.inet6 > /dev/null 2>&1
;;
ipx)
${SYSCTL_N} net.ipx > /dev/null 2>&1
@@ -512,6 +517,13 @@ ipv4_up()
_if=$1
_ret=1
+ # Add 127.0.0.1/8 to lo0 unless otherwise specified.
+ if [ "${_if}" = "lo0" ]; then
+ ifconfig_args=`ifconfig_getargs ${_if}`
+ if [ -z "${ifconfig_args}" ]; then
+ ifconfig ${_if} inet 127.0.0.1/8 alias
+ fi
+ fi
ifalias_up ${_if} inet && _ret=0
ipv4_addrs_common ${_if} alias && _ret=0