network revision 1.64
11.1Slukem#!/bin/sh 21.1Slukem# 31.64Suebayasi# $NetBSD: network,v 1.64 2014/04/29 09:42:51 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.63Schristosintmissing() { 201.63Schristos local int="$1" 211.63Schristos shift 221.63Schristos for i 231.63Schristos 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.1Slukemnetwork_start() 321.1Slukem{ 331.1Slukem # set hostname, turn on network 341.1Slukem # 351.1Slukem echo "Starting network." 361.1Slukem 371.64Suebayasi network_start_hostname 381.64Suebayasi network_start_domainname 391.64Suebayasi network_start_loopback 401.64Suebayasi network_start_ipv6_route 411.64Suebayasi network_start_interfaces 421.64Suebayasi network_start_aliases 431.64Suebayasi network_start_defaultroute 441.64Suebayasi network_start_defaultroute6 451.64Suebayasi network_start_ipv6_autoconf 461.64Suebayasi network_start_local 471.64Suebayasi} 481.64Suebayasi 491.64Suebayasinetwork_start_hostname() 501.64Suebayasi{ 511.1Slukem # If $hostname is set, use it for my Internet name, 521.1Slukem # otherwise use /etc/myname 531.1Slukem # 541.20Snisimura if [ -z "$hostname" ] && [ -f /etc/myname ]; then 551.46Schristos hostname=$(cat /etc/myname) 561.1Slukem fi 571.1Slukem if [ -n "$hostname" ]; then 581.1Slukem echo "Hostname: $hostname" 591.1Slukem hostname $hostname 601.1Slukem else 611.8Sthorpej # Don't warn about it if we're going to run 621.8Sthorpej # DHCP later, as we will probably get the 631.8Sthorpej # hostname at that time. 641.8Sthorpej # 651.58Sroy if ! checkyesno dhclient && ! checkyesno dhcpcd && \ 661.58Sroy [ -z "$(hostname)" ] 671.58Sroy then 681.8Sthorpej warn "\$hostname not set." 691.8Sthorpej fi 701.1Slukem fi 711.64Suebayasi} 721.1Slukem 731.64Suebayasinetwork_start_domainname() 741.64Suebayasi{ 751.1Slukem # Check $domainname first, then /etc/defaultdomain, 761.1Slukem # for NIS/YP domain name 771.1Slukem # 781.20Snisimura if [ -z "$domainname" ] && [ -f /etc/defaultdomain ]; then 791.46Schristos domainname=$(cat /etc/defaultdomain) 801.1Slukem fi 811.1Slukem if [ -n "$domainname" ]; then 821.1Slukem echo "NIS domainname: $domainname" 831.1Slukem domainname $domainname 841.1Slukem fi 851.1Slukem 861.1Slukem # Flush all routes just to make sure it is clean 871.1Slukem if checkyesno flushroutes; then 881.53Sreed /sbin/route -qn flush 891.1Slukem fi 901.64Suebayasi} 911.1Slukem 921.64Suebayasinetwork_start_loopback() 931.64Suebayasi{ 941.1Slukem # Set the address for the first loopback interface, so that the 951.1Slukem # auto-route from a newly configured interface's address to lo0 961.1Slukem # works correctly. 971.1Slukem # 981.32Slukem # NOTE: obscure networking problems will occur if lo0 isn't configured. 991.1Slukem # 1001.53Sreed /sbin/ifconfig lo0 inet 127.0.0.1 1011.10Sitojun 1021.31Sitojun # According to RFC1122, 127.0.0.0/8 must not leave the node. 1031.10Sitojun # 1041.53Sreed /sbin/route -q add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject 1051.64Suebayasi} 1061.1Slukem 1071.64Suebayasinetwork_start_ipv6_route() 1081.64Suebayasi{ 1091.30Sitojun # IPv6 routing setups, and host/router mode selection. 1101.30Sitojun # 1111.53Sreed if /sbin/ifconfig lo0 inet6 >/dev/null 2>&1; then 1121.30Sitojun # We have IPv6 support in kernel. 1131.30Sitojun 1141.30Sitojun # disallow link-local unicast dest without outgoing scope 1151.30Sitojun # identifiers. 1161.30Sitojun # 1171.53Sreed /sbin/route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject 1181.30Sitojun 1191.50Srpaulo # disallow the use of the RFC3849 documentation address 1201.50Srpaulo # 1211.53Sreed /sbin/route -q add -inet6 2001:db8:: -prefixlen 32 ::1 -reject 1221.50Srpaulo 1231.50Srpaulo # IPv6 site-local scoped address prefix (fec0::/10) 1241.50Srpaulo # has been deprecated by RFC3879. 1251.30Sitojun # 1261.50Srpaulo if [ -n "$ip6sitelocal" ]; then 1271.50Srpaulo warn "\$ip6sitelocal is no longer valid" 1281.30Sitojun fi 1291.30Sitojun 1301.30Sitojun # disallow "internal" addresses to appear on the wire. 1311.30Sitojun # 1321.53Sreed /sbin/route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject 1331.30Sitojun 1341.30Sitojun # disallow packets to malicious IPv4 compatible prefix 1351.30Sitojun # 1361.53Sreed /sbin/route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject 1371.53Sreed /sbin/route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject 1381.53Sreed /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject 1391.53Sreed /sbin/route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject 1401.30Sitojun 1411.30Sitojun # disallow packets to malicious 6to4 prefix 1421.30Sitojun # 1431.53Sreed /sbin/route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject 1441.53Sreed /sbin/route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject 1451.53Sreed /sbin/route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject 1461.53Sreed /sbin/route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject 1471.30Sitojun 1481.30Sitojun # Completely disallow packets to IPv4 compatible prefix. 1491.30Sitojun # This may conflict with RFC1933 under following circumstances: 1501.30Sitojun # (1) An IPv6-only KAME node tries to originate packets to IPv4 1511.51Sreed # compatible destination. The KAME node has no IPv4 1521.30Sitojun # compatible support. Under RFC1933, it should transmit 1531.30Sitojun # native IPv6 packets toward IPv4 compatible destination, 1541.30Sitojun # hoping it would reach a router that forwards the packet 1551.30Sitojun # toward auto-tunnel interface. 1561.30Sitojun # (2) An IPv6-only node originates a packet to IPv4 compatible 1571.30Sitojun # destination. A KAME node is acting as an IPv6 router, and 1581.30Sitojun # asked to forward it. 1591.30Sitojun # Due to rare use of IPv4 compatible address, and security 1601.30Sitojun # issues with it, we disable it by default. 1611.30Sitojun # 1621.53Sreed /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject 1631.30Sitojun 1641.53Sreed /sbin/sysctl -qw net.inet6.ip6.forwarding=0 1651.53Sreed /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0 1661.30Sitojun 1671.30Sitojun case $ip6mode in 1681.30Sitojun router) 1691.30Sitojun echo 'IPv6 mode: router' 1701.53Sreed /sbin/sysctl -qw net.inet6.ip6.forwarding=1 1711.50Srpaulo 1721.50Srpaulo # disallow unique-local unicast forwarding without 1731.50Srpaulo # explicit configuration. 1741.50Srpaulo if ! checkyesno ip6uniquelocal; then 1751.53Sreed /sbin/route -q add -inet6 fc00:: -prefixlen 7 \ 1761.50Srpaulo ::1 -reject 1771.50Srpaulo fi 1781.30Sitojun ;; 1791.30Sitojun 1801.30Sitojun autohost) 1811.30Sitojun echo 'IPv6 mode: autoconfigured host' 1821.53Sreed /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1 1831.30Sitojun ;; 1841.30Sitojun 1851.30Sitojun host) 1861.30Sitojun echo 'IPv6 mode: host' 1871.30Sitojun ;; 1881.30Sitojun 1891.36Slukem *) warn "invalid \$ip6mode value "\"$ip6mode\" 1901.30Sitojun ;; 1911.30Sitojun 1921.30Sitojun esac 1931.30Sitojun fi 1941.64Suebayasi} 1951.30Sitojun 1961.64Suebayasinetwork_start_interfaces() 1971.64Suebayasi{ 1981.1Slukem # Configure all of the network interfaces listed in $net_interfaces; 1991.1Slukem # if $auto_ifconfig is YES, grab all interfaces from ifconfig. 2001.1Slukem # In the following, "xxN" stands in for interface names, like "le0". 2011.54Sapb # 2021.54Sapb # For any interfaces that has an $ifconfig_xxN variable 2031.54Sapb # associated, we break it into lines using ';' as a separator, 2041.54Sapb # then process it just like the contents of an /etc/ifconfig.xxN 2051.54Sapb # file. 2061.54Sapb # 2071.54Sapb # For each line from the $ifconfig_xxN variable or the 2081.54Sapb # /etc/ifconfig.xxN file, we ignore comments and blank lines, 2091.54Sapb # treat lines beginning with "!" as commands to execute, treat 2101.54Sapb # "dhcp" as a special case to invoke dhcpcd, and for any other 2111.54Sapb # line we run "ifconfig xxN", using each line of the file as the 2121.54Sapb # arguments for a separate "ifconfig" invocation. 2131.1Slukem # 2141.1Slukem # In order to configure an interface reasonably, you at the very least 2151.1Slukem # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), 2161.1Slukem # and probably a netmask (as in "netmask 0xffffffe0"). You will 2171.1Slukem # frequently need to specify a media type, as in "media UTP", for 2181.1Slukem # interface cards with multiple media connections that do not 2191.1Slukem # autoconfigure. See the ifconfig manual page for details. 2201.1Slukem # 2211.1Slukem # Note that /etc/ifconfig.xxN takes multiple lines. The following 2221.1Slukem # configuration is possible: 2231.1Slukem # inet 10.1.1.1 netmask 0xffffff00 2241.1Slukem # inet 10.1.1.2 netmask 0xffffff00 alias 2251.50Srpaulo # inet6 2001:db8::1 prefixlen 64 alias 2261.1Slukem # 2271.29Sitojun # You can put shell script fragment into /etc/ifconfig.xxN by 2281.29Sitojun # starting a line with "!". Refer to ifconfig.if(5) for details. 2291.29Sitojun # 2301.1Slukem if [ "$net_interfaces" != NO ]; then 2311.63Schristos ifaces="$(/sbin/ifconfig -l)" 2321.1Slukem if checkyesno auto_ifconfig; then 2331.63Schristos tmp="$ifaces" 2341.63Schristos for cloner in $(/sbin/ifconfig -C); do 2351.25Swiz for int in /etc/ifconfig.${cloner}[0-9]*; do 2361.23Snisimura [ ! -f $int ] && break 2371.21Slukem tmp="$tmp ${int##*.}" 2381.15Sthorpej done 2391.15Sthorpej done 2401.1Slukem else 2411.1Slukem tmp="$net_interfaces" 2421.1Slukem fi 2431.1Slukem echo -n 'Configuring network interfaces:' 2441.1Slukem for int in $tmp; do 2451.54Sapb eval argslist=\$ifconfig_$int 2461.54Sapb 2471.54Sapb # Skip interfaces that do not have explicit 2481.54Sapb # configuration information. If auto_ifconfig is 2491.54Sapb # false then also warn about such interfaces. 2501.54Sapb # 2511.54Sapb if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ] 2521.54Sapb then 2531.1Slukem if ! checkyesno auto_ifconfig; then 2541.1Slukem echo 2551.1Slukem warn \ 2561.1Slukem "/etc/ifconfig.$int missing and ifconfig_$int not set;" 2571.1Slukem warn "interface $int not configured." 2581.1Slukem fi 2591.1Slukem continue 2601.1Slukem fi 2611.54Sapb 2621.54Sapb echo -n " $int" 2631.54Sapb 2641.54Sapb # Create the interface if necessary. 2651.54Sapb # If the interface did not exist before, 2661.54Sapb # then also resync ipf(4). 2671.54Sapb # 2681.63Schristos if intmissing $int $ifaces; then 2691.63Schristos if /sbin/ifconfig $int create && \ 2701.63Schristos checkyesno ipfilter; then 2711.63Schristos /sbin/ipf -y >/dev/null 2721.63Schristos fi 2731.54Sapb fi 2741.54Sapb 2751.54Sapb # If $ifconfig_xxN is empty, then use 2761.54Sapb # /etc/ifconfig.xxN, which we know exists due to 2771.54Sapb # an earlier test. 2781.54Sapb # 2791.54Sapb # If $ifconfig_xxN is non-empty and contains a 2801.54Sapb # newline, then just use it as is. (This allows 2811.54Sapb # semicolons through unmolested.) 2821.54Sapb # 2831.54Sapb # If $ifconfig_xxN is non-empty and does not 2841.54Sapb # contain a newline, then convert all semicolons 2851.54Sapb # to newlines. 2861.54Sapb # 2871.54Sapb case "$argslist" in 2881.54Sapb '') 2891.54Sapb cat /etc/ifconfig.$int 2901.54Sapb ;; 2911.54Sapb *"${nl}"*) 2921.54Sapb echo "$argslist" 2931.54Sapb ;; 2941.54Sapb *) 2951.54Sapb ( 2961.54Sapb set -o noglob 2971.54Sapb IFS=';'; set -- $argslist 2981.54Sapb #echo >&2 "[$#] [$1] [$2] [$3] [$4]" 2991.54Sapb IFS="$nl"; echo "$*" 3001.54Sapb ) 3011.54Sapb ;; 3021.54Sapb esac | 3031.61Sapb collapse_backslash_newline | 3041.54Sapb while read -r args; do 3051.54Sapb case "$args" in 3061.54Sapb ''|"#"*|create) 3071.54Sapb ;; 3081.54Sapb "!"*) 3091.54Sapb # Run arbitrary command in a subshell. 3101.54Sapb ( eval "${args#*!}" ) 3111.54Sapb ;; 3121.54Sapb dhcp) 3131.58Sroy if ! checkyesno dhcpcd; then 3141.58Sroy /sbin/dhcpcd -n \ 3151.58Sroy ${dhcpcd_flags} $int 3161.58Sroy fi 3171.54Sapb ;; 3181.54Sapb *) 3191.54Sapb # Pass args to ifconfig. Note 3201.54Sapb # that args may contain embedded 3211.54Sapb # shell metacharacters, such as 3221.57Schristos # "ssid 'foo;*>bar'". We eval 3231.57Schristos # one more time so that things 3241.57Schristos # like ssid "Columbia University" work. 3251.54Sapb ( 3261.54Sapb set -o noglob 3271.57Schristos eval set -- $args 3281.54Sapb #echo >&2 "[$#] [$1] [$2] [$3]" 3291.54Sapb /sbin/ifconfig $int "$@" 3301.54Sapb ) 3311.54Sapb ;; 3321.54Sapb esac 3331.54Sapb done 3341.1Slukem configured_interfaces="$configured_interfaces $int" 3351.1Slukem done 3361.1Slukem echo "." 3371.1Slukem fi 3381.64Suebayasi} 3391.1Slukem 3401.64Suebayasinetwork_start_aliases() 3411.64Suebayasi{ 3421.48Scjs echo -n "Adding interface aliases:" 3431.48Scjs 3441.1Slukem # Check if each configured interface xxN has an $ifaliases_xxN variable 3451.1Slukem # associated, then configure additional IP addresses for that interface. 3461.1Slukem # The variable contains a list of "address netmask" pairs, with 3471.1Slukem # "netmask" set to "-" if the interface default netmask is to be used. 3481.1Slukem # 3491.54Sapb # Note that $ifaliases_xxN works only in certain cases and its 3501.54Sapb # use is not recommended. Use /etc/ifconfig.xxN or multiple 3511.54Sapb # commands in $ifconfig_xxN instead. 3521.1Slukem # 3531.48Scjs for int in lo0 $configured_interfaces; do 3541.20Snisimura eval args=\$ifaliases_$int 3551.1Slukem if [ -n "$args" ]; then 3561.1Slukem set -- $args 3571.1Slukem while [ $# -ge 2 ]; do 3581.1Slukem addr=$1 ; net=$2 ; shift 2 3591.1Slukem if [ "$net" = "-" ]; then 3601.16Sjdolecek # for compatibility only, obsolete 3611.53Sreed /sbin/ifconfig $int inet alias $addr 3621.1Slukem else 3631.53Sreed /sbin/ifconfig $int inet alias $addr \ 3641.1Slukem netmask $net 3651.1Slukem fi 3661.48Scjs echo -n " $int:$addr" 3671.1Slukem done 3681.1Slukem fi 3691.1Slukem done 3701.1Slukem 3711.1Slukem # /etc/ifaliases, if it exists, contains the names of additional IP 3721.1Slukem # addresses for each interface. It is formatted as a series of lines 3731.1Slukem # that contain 3741.1Slukem # address interface netmask 3751.1Slukem # 3761.54Sapb # Note that /etc/ifaliases works only in certain cases and its 3771.54Sapb # use is not recommended. Use /etc/ifconfig.xxN or multiple 3781.54Sapb # commands in $ifconfig_xxN instead. 3791.1Slukem # 3801.1Slukem if [ -f /etc/ifaliases ]; then 3811.1Slukem while read addr int net; do 3821.1Slukem if [ -z "$net" ]; then 3831.16Sjdolecek # for compatibility only, obsolete 3841.53Sreed /sbin/ifconfig $int inet alias $addr 3851.1Slukem else 3861.53Sreed /sbin/ifconfig $int inet alias $addr netmask $net 3871.1Slukem fi 3881.20Snisimura done < /etc/ifaliases 3891.1Slukem fi 3901.1Slukem 3911.56Sapb echo "." # for "Adding interface aliases:" 3921.64Suebayasi} 3931.56Sapb 3941.64Suebayasinetwork_start_defaultroute() 3951.64Suebayasi{ 3961.56Sapb # Check $defaultroute, then /etc/mygate, for the name or address 3971.56Sapb # of my IPv4 gateway host. If using a name, that name must be in 3981.56Sapb # /etc/hosts. 3991.56Sapb # 4001.56Sapb if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then 4011.56Sapb defaultroute=$(cat /etc/mygate) 4021.56Sapb fi 4031.56Sapb if [ -n "$defaultroute" ]; then 4041.56Sapb /sbin/route add default $defaultroute 4051.56Sapb fi 4061.64Suebayasi} 4071.56Sapb 4081.64Suebayasinetwork_start_defaultroute6() 4091.64Suebayasi{ 4101.56Sapb # Check $defaultroute6, then /etc/mygate6, for the name or address 4111.56Sapb # of my IPv6 gateway host. If using a name, that name must be in 4121.56Sapb # /etc/hosts. Note that the gateway host address must be a link-local 4131.56Sapb # address if it is not using an stf* interface. 4141.56Sapb # 4151.56Sapb if [ -z "$defaultroute6" ] && [ -f /etc/mygate6 ]; then 4161.56Sapb defaultroute6=$(cat /etc/mygate6) 4171.56Sapb fi 4181.56Sapb if [ -n "$defaultroute6" ]; then 4191.56Sapb if [ "$ip6mode" = "autohost" ]; then 4201.56Sapb echo 4211.56Sapb warn \ 4221.56Sapb "ip6mode is set to 'autohost' and a v6 default route is also set." 4231.56Sapb fi 4241.56Sapb /sbin/route add -inet6 default $defaultroute6 4251.56Sapb fi 4261.64Suebayasi} 4271.48Scjs 4281.64Suebayasinetwork_start_ipv6_autoconf() 4291.64Suebayasi{ 4301.30Sitojun # IPv6 interface autoconfiguration. 4311.1Slukem # 4321.53Sreed if /sbin/ifconfig lo0 inet6 >/dev/null 2>&1; then 4331.17Sitojun # wait till DAD is completed. always invoke it in case 4341.17Sitojun # if are configured manually by ifconfig 4351.17Sitojun # 4361.62Syamt echo 'Waiting for DAD completion for' \ 4371.62Syamt 'statically configured addresses...' 4381.53Sreed dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null) 4391.17Sitojun sleep $dadcount 4401.17Sitojun sleep 1 4411.17Sitojun 4421.1Slukem if checkyesno rtsol; then 4431.1Slukem if [ "$ip6mode" = "autohost" ]; then 4441.1Slukem echo 'Sending router solicitation...' 4451.53Sreed /sbin/rtsol $rtsol_flags 4461.1Slukem else 4471.1Slukem echo 4481.1Slukem warn \ 4491.1Slukem "ip6mode must be set to 'autohost' to use rtsol." 4501.1Slukem fi 4511.17Sitojun 4521.18Sitojun # wait till DAD is completed, for global addresses 4531.18Sitojun # configured by router advert message. 4541.17Sitojun # 4551.62Syamt echo 'Waiting for DAD completion for' \ 4561.62Syamt 'addresses configured by router advert message...' 4571.17Sitojun sleep $dadcount 4581.17Sitojun sleep 1 4591.1Slukem fi 4601.42Schristos fi 4611.64Suebayasi} 4621.42Schristos 4631.64Suebayasinetwork_start_local() 4641.64Suebayasi{ 4651.1Slukem # XXX this must die 4661.1Slukem if [ -s /etc/netstart.local ]; then 4671.1Slukem sh /etc/netstart.local start 4681.1Slukem fi 4691.1Slukem} 4701.1Slukem 4711.1Slukemnetwork_stop() 4721.1Slukem{ 4731.1Slukem echo "Stopping network." 4741.1Slukem 4751.64Suebayasi network_stop_local 4761.64Suebayasi network_stop_aliases 4771.64Suebayasi network_stop_interfaces 4781.64Suebayasi network_stop_route 4791.64Suebayasi} 4801.64Suebayasi 4811.64Suebayasinetwork_stop_local() 4821.64Suebayasi{ 4831.1Slukem # XXX this must die 4841.1Slukem if [ -s /etc/netstart.local ]; then 4851.1Slukem sh /etc/netstart.local stop 4861.1Slukem fi 4871.64Suebayasi} 4881.1Slukem 4891.64Suebayasinetwork_stop_aliases() 4901.64Suebayasi{ 4911.1Slukem echo "Deleting aliases." 4921.1Slukem if [ -f /etc/ifaliases ]; then 4931.1Slukem while read addr int net; do 4941.53Sreed /sbin/ifconfig $int inet delete $addr 4951.20Snisimura done < /etc/ifaliases 4961.1Slukem fi 4971.1Slukem 4981.53Sreed for int in $(/sbin/ifconfig -lu); do 4991.20Snisimura eval args=\$ifaliases_$int 5001.1Slukem if [ -n "$args" ]; then 5011.1Slukem set -- $args 5021.1Slukem while [ $# -ge 2 ]; do 5031.1Slukem addr=$1 ; net=$2 ; shift 2 5041.53Sreed /sbin/ifconfig $int inet delete $addr 5051.1Slukem done 5061.1Slukem fi 5071.1Slukem done 5081.64Suebayasi} 5091.1Slukem 5101.64Suebayasinetwork_stop_interfaces() 5111.64Suebayasi{ 5121.1Slukem # down interfaces 5131.1Slukem # 5141.1Slukem echo -n 'Downing network interfaces:' 5151.1Slukem if [ "$net_interfaces" != NO ]; then 5161.1Slukem if checkyesno auto_ifconfig; then 5171.53Sreed tmp=$(/sbin/ifconfig -l) 5181.1Slukem else 5191.1Slukem tmp="$net_interfaces" 5201.1Slukem fi 5211.1Slukem for int in $tmp; do 5221.20Snisimura eval args=\$ifconfig_$int 5231.2Sveego if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then 5241.1Slukem echo -n " $int" 5251.58Sroy if [ -f /var/run/dhcpcd-$int.pid ]; then 5261.58Sroy /sbin/dhcpcd -k $int 2> /dev/null 5271.58Sroy fi 5281.53Sreed /sbin/ifconfig $int down 5291.53Sreed if /sbin/ifconfig $int destroy 2>/dev/null && \ 5301.39Stron checkyesno ipfilter; then 5311.39Stron # resync ipf(4) 5321.53Sreed /sbin/ipf -y >/dev/null 5331.39Stron fi 5341.1Slukem fi 5351.1Slukem done 5361.1Slukem echo "." 5371.1Slukem fi 5381.64Suebayasi} 5391.1Slukem 5401.64Suebayasinetwork_stop_route() 5411.64Suebayasi{ 5421.1Slukem # flush routes 5431.1Slukem # 5441.53Sreed /sbin/route -qn flush 5451.38Stron 5461.1Slukem} 5471.1Slukem 5481.47Slukemload_rc_config $name 5491.47Slukemload_rc_config_var dhclient dhclient 5501.58Sroyload_rc_config_var dhcpcd dhcpcd 5511.47Slukemload_rc_config_var ipfilter ipfilter 5521.1Slukemrun_rc_command "$1" 553