network revision 1.65
11.1Slukem#!/bin/sh 21.1Slukem# 31.64Suebayasi# $NetBSD: network,v 1.65 2014/04/29 09:56:16 uebayasi Exp $ 41.1Slukem# 51.1Slukem 61.1Slukem# PROVIDE: network 71.19Slukem# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl 81.34Sthorpej# BEFORE: NETWORKING 91.1Slukem 101.45Smycroft$_rc_subr_loaded . /etc/rc.subr 111.1Slukem 121.1Slukemname="network" 131.1Slukemstart_cmd="network_start" 141.14Slukemstop_cmd="network_stop" 151.1Slukem 161.54Sapbnl=' 171.54Sapb' # a newline 181.54Sapb 191.65Suebayasiintmissing() 201.65Suebayasi{ 211.63Schristos local int="$1" 221.63Schristos shift 231.65Suebayasi for i; do 241.63Schristos if [ "$int" = "$i" ]; then 251.63Schristos return 1 261.63Schristos fi 271.63Schristos done 281.63Schristos return 0 291.63Schristos} 301.63Schristos 311.65Suebayasihave_inet6() 321.65Suebayasi{ 331.65Suebayasi /sbin/ifconfig lo0 inet6 >/dev/null 2>&1 341.65Suebayasi} 351.65Suebayasi 361.1Slukemnetwork_start() 371.1Slukem{ 381.1Slukem # set hostname, turn on network 391.1Slukem # 401.1Slukem echo "Starting network." 411.1Slukem 421.64Suebayasi network_start_hostname 431.64Suebayasi network_start_domainname 441.64Suebayasi network_start_loopback 451.65Suebayasi have_inet6 && 461.64Suebayasi network_start_ipv6_route 471.65Suebayasi [ "$net_interfaces" != NO ] && 481.64Suebayasi network_start_interfaces 491.64Suebayasi network_start_aliases 501.64Suebayasi network_start_defaultroute 511.64Suebayasi network_start_defaultroute6 521.65Suebayasi have_inet6 && 531.64Suebayasi network_start_ipv6_autoconf 541.64Suebayasi network_start_local 551.64Suebayasi} 561.64Suebayasi 571.64Suebayasinetwork_start_hostname() 581.64Suebayasi{ 591.1Slukem # If $hostname is set, use it for my Internet name, 601.1Slukem # otherwise use /etc/myname 611.1Slukem # 621.20Snisimura if [ -z "$hostname" ] && [ -f /etc/myname ]; then 631.46Schristos hostname=$(cat /etc/myname) 641.1Slukem fi 651.1Slukem if [ -n "$hostname" ]; then 661.1Slukem echo "Hostname: $hostname" 671.1Slukem hostname $hostname 681.1Slukem else 691.8Sthorpej # Don't warn about it if we're going to run 701.8Sthorpej # DHCP later, as we will probably get the 711.8Sthorpej # hostname at that time. 721.8Sthorpej # 731.58Sroy if ! checkyesno dhclient && ! checkyesno dhcpcd && \ 741.58Sroy [ -z "$(hostname)" ] 751.58Sroy then 761.8Sthorpej warn "\$hostname not set." 771.8Sthorpej fi 781.1Slukem fi 791.64Suebayasi} 801.1Slukem 811.64Suebayasinetwork_start_domainname() 821.64Suebayasi{ 831.1Slukem # Check $domainname first, then /etc/defaultdomain, 841.1Slukem # for NIS/YP domain name 851.1Slukem # 861.20Snisimura if [ -z "$domainname" ] && [ -f /etc/defaultdomain ]; then 871.46Schristos domainname=$(cat /etc/defaultdomain) 881.1Slukem fi 891.1Slukem if [ -n "$domainname" ]; then 901.1Slukem echo "NIS domainname: $domainname" 911.1Slukem domainname $domainname 921.1Slukem fi 931.1Slukem 941.1Slukem # Flush all routes just to make sure it is clean 951.1Slukem if checkyesno flushroutes; then 961.53Sreed /sbin/route -qn flush 971.1Slukem fi 981.64Suebayasi} 991.1Slukem 1001.64Suebayasinetwork_start_loopback() 1011.64Suebayasi{ 1021.1Slukem # Set the address for the first loopback interface, so that the 1031.1Slukem # auto-route from a newly configured interface's address to lo0 1041.1Slukem # works correctly. 1051.1Slukem # 1061.32Slukem # NOTE: obscure networking problems will occur if lo0 isn't configured. 1071.1Slukem # 1081.53Sreed /sbin/ifconfig lo0 inet 127.0.0.1 1091.10Sitojun 1101.31Sitojun # According to RFC1122, 127.0.0.0/8 must not leave the node. 1111.10Sitojun # 1121.53Sreed /sbin/route -q add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject 1131.64Suebayasi} 1141.1Slukem 1151.64Suebayasinetwork_start_ipv6_route() 1161.64Suebayasi{ 1171.30Sitojun # IPv6 routing setups, and host/router mode selection. 1181.30Sitojun # 1191.30Sitojun # We have IPv6 support in kernel. 1201.30Sitojun 1211.30Sitojun # disallow link-local unicast dest without outgoing scope 1221.30Sitojun # identifiers. 1231.30Sitojun # 1241.53Sreed /sbin/route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject 1251.30Sitojun 1261.50Srpaulo # disallow the use of the RFC3849 documentation address 1271.50Srpaulo # 1281.53Sreed /sbin/route -q add -inet6 2001:db8:: -prefixlen 32 ::1 -reject 1291.50Srpaulo 1301.50Srpaulo # IPv6 site-local scoped address prefix (fec0::/10) 1311.50Srpaulo # has been deprecated by RFC3879. 1321.30Sitojun # 1331.50Srpaulo if [ -n "$ip6sitelocal" ]; then 1341.50Srpaulo warn "\$ip6sitelocal is no longer valid" 1351.30Sitojun fi 1361.30Sitojun 1371.30Sitojun # disallow "internal" addresses to appear on the wire. 1381.30Sitojun # 1391.53Sreed /sbin/route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject 1401.30Sitojun 1411.30Sitojun # disallow packets to malicious IPv4 compatible prefix 1421.30Sitojun # 1431.53Sreed /sbin/route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject 1441.53Sreed /sbin/route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject 1451.53Sreed /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject 1461.53Sreed /sbin/route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject 1471.30Sitojun 1481.30Sitojun # disallow packets to malicious 6to4 prefix 1491.30Sitojun # 1501.53Sreed /sbin/route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject 1511.53Sreed /sbin/route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject 1521.53Sreed /sbin/route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject 1531.53Sreed /sbin/route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject 1541.30Sitojun 1551.30Sitojun # Completely disallow packets to IPv4 compatible prefix. 1561.30Sitojun # This may conflict with RFC1933 under following circumstances: 1571.30Sitojun # (1) An IPv6-only KAME node tries to originate packets to IPv4 1581.51Sreed # compatible destination. The KAME node has no IPv4 1591.30Sitojun # compatible support. Under RFC1933, it should transmit 1601.30Sitojun # native IPv6 packets toward IPv4 compatible destination, 1611.30Sitojun # hoping it would reach a router that forwards the packet 1621.30Sitojun # toward auto-tunnel interface. 1631.30Sitojun # (2) An IPv6-only node originates a packet to IPv4 compatible 1641.30Sitojun # destination. A KAME node is acting as an IPv6 router, and 1651.30Sitojun # asked to forward it. 1661.30Sitojun # Due to rare use of IPv4 compatible address, and security 1671.30Sitojun # issues with it, we disable it by default. 1681.30Sitojun # 1691.53Sreed /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject 1701.30Sitojun 1711.53Sreed /sbin/sysctl -qw net.inet6.ip6.forwarding=0 1721.53Sreed /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0 1731.30Sitojun 1741.30Sitojun case $ip6mode in 1751.30Sitojun router) 1761.30Sitojun echo 'IPv6 mode: router' 1771.53Sreed /sbin/sysctl -qw net.inet6.ip6.forwarding=1 1781.50Srpaulo 1791.50Srpaulo # disallow unique-local unicast forwarding without 1801.50Srpaulo # explicit configuration. 1811.50Srpaulo if ! checkyesno ip6uniquelocal; then 1821.53Sreed /sbin/route -q add -inet6 fc00:: -prefixlen 7 \ 1831.50Srpaulo ::1 -reject 1841.50Srpaulo fi 1851.30Sitojun ;; 1861.30Sitojun 1871.30Sitojun autohost) 1881.30Sitojun echo 'IPv6 mode: autoconfigured host' 1891.53Sreed /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1 1901.30Sitojun ;; 1911.30Sitojun 1921.30Sitojun host) 1931.30Sitojun echo 'IPv6 mode: host' 1941.30Sitojun ;; 1951.30Sitojun 1961.36Slukem *) warn "invalid \$ip6mode value "\"$ip6mode\" 1971.30Sitojun ;; 1981.30Sitojun 1991.30Sitojun esac 2001.64Suebayasi} 2011.30Sitojun 2021.64Suebayasinetwork_start_interfaces() 2031.64Suebayasi{ 2041.1Slukem # Configure all of the network interfaces listed in $net_interfaces; 2051.1Slukem # if $auto_ifconfig is YES, grab all interfaces from ifconfig. 2061.1Slukem # In the following, "xxN" stands in for interface names, like "le0". 2071.54Sapb # 2081.54Sapb # For any interfaces that has an $ifconfig_xxN variable 2091.54Sapb # associated, we break it into lines using ';' as a separator, 2101.54Sapb # then process it just like the contents of an /etc/ifconfig.xxN 2111.54Sapb # file. 2121.54Sapb # 2131.54Sapb # For each line from the $ifconfig_xxN variable or the 2141.54Sapb # /etc/ifconfig.xxN file, we ignore comments and blank lines, 2151.54Sapb # treat lines beginning with "!" as commands to execute, treat 2161.54Sapb # "dhcp" as a special case to invoke dhcpcd, and for any other 2171.54Sapb # line we run "ifconfig xxN", using each line of the file as the 2181.54Sapb # arguments for a separate "ifconfig" invocation. 2191.1Slukem # 2201.1Slukem # In order to configure an interface reasonably, you at the very least 2211.1Slukem # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), 2221.1Slukem # and probably a netmask (as in "netmask 0xffffffe0"). You will 2231.1Slukem # frequently need to specify a media type, as in "media UTP", for 2241.1Slukem # interface cards with multiple media connections that do not 2251.1Slukem # autoconfigure. See the ifconfig manual page for details. 2261.1Slukem # 2271.1Slukem # Note that /etc/ifconfig.xxN takes multiple lines. The following 2281.1Slukem # configuration is possible: 2291.1Slukem # inet 10.1.1.1 netmask 0xffffff00 2301.1Slukem # inet 10.1.1.2 netmask 0xffffff00 alias 2311.50Srpaulo # inet6 2001:db8::1 prefixlen 64 alias 2321.1Slukem # 2331.29Sitojun # You can put shell script fragment into /etc/ifconfig.xxN by 2341.29Sitojun # starting a line with "!". Refer to ifconfig.if(5) for details. 2351.29Sitojun # 2361.63Schristos ifaces="$(/sbin/ifconfig -l)" 2371.1Slukem if checkyesno auto_ifconfig; then 2381.63Schristos tmp="$ifaces" 2391.63Schristos for cloner in $(/sbin/ifconfig -C); do 2401.25Swiz for int in /etc/ifconfig.${cloner}[0-9]*; do 2411.23Snisimura [ ! -f $int ] && break 2421.21Slukem tmp="$tmp ${int##*.}" 2431.15Sthorpej done 2441.15Sthorpej done 2451.1Slukem else 2461.1Slukem tmp="$net_interfaces" 2471.1Slukem fi 2481.1Slukem echo -n 'Configuring network interfaces:' 2491.1Slukem for int in $tmp; do 2501.54Sapb eval argslist=\$ifconfig_$int 2511.54Sapb 2521.54Sapb # Skip interfaces that do not have explicit 2531.54Sapb # configuration information. If auto_ifconfig is 2541.54Sapb # false then also warn about such interfaces. 2551.54Sapb # 2561.54Sapb if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ] 2571.54Sapb then 2581.1Slukem if ! checkyesno auto_ifconfig; then 2591.1Slukem echo 2601.1Slukem warn \ 2611.1Slukem "/etc/ifconfig.$int missing and ifconfig_$int not set;" 2621.1Slukem warn "interface $int not configured." 2631.1Slukem fi 2641.1Slukem continue 2651.1Slukem fi 2661.54Sapb 2671.54Sapb echo -n " $int" 2681.54Sapb 2691.54Sapb # Create the interface if necessary. 2701.54Sapb # If the interface did not exist before, 2711.54Sapb # then also resync ipf(4). 2721.54Sapb # 2731.63Schristos if intmissing $int $ifaces; then 2741.63Schristos if /sbin/ifconfig $int create && \ 2751.63Schristos checkyesno ipfilter; then 2761.63Schristos /sbin/ipf -y >/dev/null 2771.63Schristos fi 2781.54Sapb fi 2791.54Sapb 2801.54Sapb # If $ifconfig_xxN is empty, then use 2811.54Sapb # /etc/ifconfig.xxN, which we know exists due to 2821.54Sapb # an earlier test. 2831.54Sapb # 2841.54Sapb # If $ifconfig_xxN is non-empty and contains a 2851.54Sapb # newline, then just use it as is. (This allows 2861.54Sapb # semicolons through unmolested.) 2871.54Sapb # 2881.54Sapb # If $ifconfig_xxN is non-empty and does not 2891.54Sapb # contain a newline, then convert all semicolons 2901.54Sapb # to newlines. 2911.54Sapb # 2921.54Sapb case "$argslist" in 2931.54Sapb '') 2941.54Sapb cat /etc/ifconfig.$int 2951.54Sapb ;; 2961.54Sapb *"${nl}"*) 2971.54Sapb echo "$argslist" 2981.54Sapb ;; 2991.54Sapb *) 3001.54Sapb ( 3011.54Sapb set -o noglob 3021.54Sapb IFS=';'; set -- $argslist 3031.54Sapb #echo >&2 "[$#] [$1] [$2] [$3] [$4]" 3041.54Sapb IFS="$nl"; echo "$*" 3051.54Sapb ) 3061.54Sapb ;; 3071.54Sapb esac | 3081.61Sapb collapse_backslash_newline | 3091.54Sapb while read -r args; do 3101.54Sapb case "$args" in 3111.54Sapb ''|"#"*|create) 3121.54Sapb ;; 3131.54Sapb "!"*) 3141.54Sapb # Run arbitrary command in a subshell. 3151.54Sapb ( eval "${args#*!}" ) 3161.54Sapb ;; 3171.54Sapb dhcp) 3181.58Sroy if ! checkyesno dhcpcd; then 3191.58Sroy /sbin/dhcpcd -n \ 3201.58Sroy ${dhcpcd_flags} $int 3211.58Sroy fi 3221.54Sapb ;; 3231.54Sapb *) 3241.54Sapb # Pass args to ifconfig. Note 3251.54Sapb # that args may contain embedded 3261.54Sapb # shell metacharacters, such as 3271.57Schristos # "ssid 'foo;*>bar'". We eval 3281.57Schristos # one more time so that things 3291.57Schristos # like ssid "Columbia University" work. 3301.54Sapb ( 3311.54Sapb set -o noglob 3321.57Schristos eval set -- $args 3331.54Sapb #echo >&2 "[$#] [$1] [$2] [$3]" 3341.54Sapb /sbin/ifconfig $int "$@" 3351.54Sapb ) 3361.54Sapb ;; 3371.54Sapb esac 3381.54Sapb done 3391.1Slukem configured_interfaces="$configured_interfaces $int" 3401.1Slukem done 3411.1Slukem echo "." 3421.64Suebayasi} 3431.1Slukem 3441.64Suebayasinetwork_start_aliases() 3451.64Suebayasi{ 3461.48Scjs echo -n "Adding interface aliases:" 3471.48Scjs 3481.1Slukem # Check if each configured interface xxN has an $ifaliases_xxN variable 3491.1Slukem # associated, then configure additional IP addresses for that interface. 3501.1Slukem # The variable contains a list of "address netmask" pairs, with 3511.1Slukem # "netmask" set to "-" if the interface default netmask is to be used. 3521.1Slukem # 3531.54Sapb # Note that $ifaliases_xxN works only in certain cases and its 3541.54Sapb # use is not recommended. Use /etc/ifconfig.xxN or multiple 3551.54Sapb # commands in $ifconfig_xxN instead. 3561.1Slukem # 3571.48Scjs for int in lo0 $configured_interfaces; do 3581.20Snisimura eval args=\$ifaliases_$int 3591.1Slukem if [ -n "$args" ]; then 3601.1Slukem set -- $args 3611.1Slukem while [ $# -ge 2 ]; do 3621.1Slukem addr=$1 ; net=$2 ; shift 2 3631.1Slukem if [ "$net" = "-" ]; then 3641.16Sjdolecek # for compatibility only, obsolete 3651.53Sreed /sbin/ifconfig $int inet alias $addr 3661.1Slukem else 3671.53Sreed /sbin/ifconfig $int inet alias $addr \ 3681.1Slukem netmask $net 3691.1Slukem fi 3701.48Scjs echo -n " $int:$addr" 3711.1Slukem done 3721.1Slukem fi 3731.1Slukem done 3741.1Slukem 3751.1Slukem # /etc/ifaliases, if it exists, contains the names of additional IP 3761.1Slukem # addresses for each interface. It is formatted as a series of lines 3771.1Slukem # that contain 3781.1Slukem # address interface netmask 3791.1Slukem # 3801.54Sapb # Note that /etc/ifaliases works only in certain cases and its 3811.54Sapb # use is not recommended. Use /etc/ifconfig.xxN or multiple 3821.54Sapb # commands in $ifconfig_xxN instead. 3831.1Slukem # 3841.1Slukem if [ -f /etc/ifaliases ]; then 3851.1Slukem while read addr int net; do 3861.1Slukem if [ -z "$net" ]; then 3871.16Sjdolecek # for compatibility only, obsolete 3881.53Sreed /sbin/ifconfig $int inet alias $addr 3891.1Slukem else 3901.53Sreed /sbin/ifconfig $int inet alias $addr netmask $net 3911.1Slukem fi 3921.20Snisimura done < /etc/ifaliases 3931.1Slukem fi 3941.1Slukem 3951.56Sapb echo "." # for "Adding interface aliases:" 3961.64Suebayasi} 3971.56Sapb 3981.64Suebayasinetwork_start_defaultroute() 3991.64Suebayasi{ 4001.56Sapb # Check $defaultroute, then /etc/mygate, for the name or address 4011.56Sapb # of my IPv4 gateway host. If using a name, that name must be in 4021.56Sapb # /etc/hosts. 4031.56Sapb # 4041.56Sapb if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then 4051.56Sapb defaultroute=$(cat /etc/mygate) 4061.56Sapb fi 4071.56Sapb if [ -n "$defaultroute" ]; then 4081.56Sapb /sbin/route add default $defaultroute 4091.56Sapb fi 4101.64Suebayasi} 4111.56Sapb 4121.64Suebayasinetwork_start_defaultroute6() 4131.64Suebayasi{ 4141.56Sapb # Check $defaultroute6, then /etc/mygate6, for the name or address 4151.56Sapb # of my IPv6 gateway host. If using a name, that name must be in 4161.56Sapb # /etc/hosts. Note that the gateway host address must be a link-local 4171.56Sapb # address if it is not using an stf* interface. 4181.56Sapb # 4191.56Sapb if [ -z "$defaultroute6" ] && [ -f /etc/mygate6 ]; then 4201.56Sapb defaultroute6=$(cat /etc/mygate6) 4211.56Sapb fi 4221.56Sapb if [ -n "$defaultroute6" ]; then 4231.56Sapb if [ "$ip6mode" = "autohost" ]; then 4241.56Sapb echo 4251.56Sapb warn \ 4261.56Sapb "ip6mode is set to 'autohost' and a v6 default route is also set." 4271.56Sapb fi 4281.56Sapb /sbin/route add -inet6 default $defaultroute6 4291.56Sapb fi 4301.64Suebayasi} 4311.48Scjs 4321.64Suebayasinetwork_start_ipv6_autoconf() 4331.64Suebayasi{ 4341.30Sitojun # IPv6 interface autoconfiguration. 4351.1Slukem # 4361.17Sitojun # wait till DAD is completed. always invoke it in case 4371.17Sitojun # if are configured manually by ifconfig 4381.17Sitojun # 4391.62Syamt echo 'Waiting for DAD completion for' \ 4401.62Syamt 'statically configured addresses...' 4411.53Sreed dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null) 4421.17Sitojun sleep $dadcount 4431.17Sitojun sleep 1 4441.17Sitojun 4451.1Slukem if checkyesno rtsol; then 4461.1Slukem if [ "$ip6mode" = "autohost" ]; then 4471.1Slukem echo 'Sending router solicitation...' 4481.53Sreed /sbin/rtsol $rtsol_flags 4491.1Slukem else 4501.1Slukem echo 4511.1Slukem warn \ 4521.1Slukem "ip6mode must be set to 'autohost' to use rtsol." 4531.1Slukem fi 4541.17Sitojun 4551.18Sitojun # wait till DAD is completed, for global addresses 4561.18Sitojun # configured by router advert message. 4571.17Sitojun # 4581.62Syamt echo 'Waiting for DAD completion for' \ 4591.62Syamt 'addresses configured by router advert message...' 4601.17Sitojun sleep $dadcount 4611.17Sitojun sleep 1 4621.1Slukem fi 4631.64Suebayasi} 4641.42Schristos 4651.64Suebayasinetwork_start_local() 4661.64Suebayasi{ 4671.1Slukem # XXX this must die 4681.1Slukem if [ -s /etc/netstart.local ]; then 4691.1Slukem sh /etc/netstart.local start 4701.1Slukem fi 4711.1Slukem} 4721.1Slukem 4731.1Slukemnetwork_stop() 4741.1Slukem{ 4751.1Slukem echo "Stopping network." 4761.1Slukem 4771.64Suebayasi network_stop_local 4781.64Suebayasi network_stop_aliases 4791.65Suebayasi [ "$net_interfaces" != NO ] && 4801.64Suebayasi network_stop_interfaces 4811.64Suebayasi network_stop_route 4821.64Suebayasi} 4831.64Suebayasi 4841.64Suebayasinetwork_stop_local() 4851.64Suebayasi{ 4861.1Slukem # XXX this must die 4871.1Slukem if [ -s /etc/netstart.local ]; then 4881.1Slukem sh /etc/netstart.local stop 4891.1Slukem fi 4901.64Suebayasi} 4911.1Slukem 4921.64Suebayasinetwork_stop_aliases() 4931.64Suebayasi{ 4941.1Slukem echo "Deleting aliases." 4951.1Slukem if [ -f /etc/ifaliases ]; then 4961.1Slukem while read addr int net; do 4971.53Sreed /sbin/ifconfig $int inet delete $addr 4981.20Snisimura done < /etc/ifaliases 4991.1Slukem fi 5001.1Slukem 5011.53Sreed for int in $(/sbin/ifconfig -lu); do 5021.20Snisimura eval args=\$ifaliases_$int 5031.1Slukem if [ -n "$args" ]; then 5041.1Slukem set -- $args 5051.1Slukem while [ $# -ge 2 ]; do 5061.1Slukem addr=$1 ; net=$2 ; shift 2 5071.53Sreed /sbin/ifconfig $int inet delete $addr 5081.1Slukem done 5091.1Slukem fi 5101.1Slukem done 5111.64Suebayasi} 5121.1Slukem 5131.64Suebayasinetwork_stop_interfaces() 5141.64Suebayasi{ 5151.1Slukem # down interfaces 5161.1Slukem # 5171.1Slukem echo -n 'Downing network interfaces:' 5181.1Slukem if checkyesno auto_ifconfig; then 5191.53Sreed tmp=$(/sbin/ifconfig -l) 5201.1Slukem else 5211.1Slukem tmp="$net_interfaces" 5221.1Slukem fi 5231.1Slukem for int in $tmp; do 5241.20Snisimura eval args=\$ifconfig_$int 5251.2Sveego if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then 5261.1Slukem echo -n " $int" 5271.58Sroy if [ -f /var/run/dhcpcd-$int.pid ]; then 5281.58Sroy /sbin/dhcpcd -k $int 2> /dev/null 5291.58Sroy fi 5301.53Sreed /sbin/ifconfig $int down 5311.53Sreed if /sbin/ifconfig $int destroy 2>/dev/null && \ 5321.39Stron checkyesno ipfilter; then 5331.39Stron # resync ipf(4) 5341.53Sreed /sbin/ipf -y >/dev/null 5351.39Stron fi 5361.1Slukem fi 5371.1Slukem done 5381.1Slukem echo "." 5391.64Suebayasi} 5401.1Slukem 5411.64Suebayasinetwork_stop_route() 5421.64Suebayasi{ 5431.1Slukem # flush routes 5441.1Slukem # 5451.53Sreed /sbin/route -qn flush 5461.38Stron 5471.1Slukem} 5481.1Slukem 5491.47Slukemload_rc_config $name 5501.47Slukemload_rc_config_var dhclient dhclient 5511.58Sroyload_rc_config_var dhcpcd dhcpcd 5521.47Slukemload_rc_config_var ipfilter ipfilter 5531.1Slukemrun_rc_command "$1" 554