No logner set an IPv4 loopback address by default in defaults/rc.conf.
If not specified, network.subr will add it automatically if we have INET support (1). In network.subr only call the address family up/down functions if the respective AF is available. Switch to new kern.features variables for inet and inet6 as the inet sysctl tree is also available for IPv6-only kernels leading to unexpected results. Suggested by: hrs (1) Reviewed by: hrs Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 20 days
This commit is contained in:
parent
b400f1ea97
commit
1dd53eaea3
@ -210,7 +210,7 @@ icmp_log_redirect="NO" # Set to YES to log ICMP REDIRECT packets
|
||||
network_interfaces="auto" # List of network interfaces (or "auto").
|
||||
cloned_interfaces="" # List of cloned network interfaces to create.
|
||||
#cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config.
|
||||
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
|
||||
#ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
|
||||
#ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
|
||||
#ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry.
|
||||
#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user