defaultroute revision 74462
1#!/bin/sh - 2# 3# Copyright (c) 1993 The FreeBSD Project 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# 27# $FreeBSD: head/etc/rc.d/routing 74462 2001-03-19 12:50:13Z alfred $ 28# From: @(#)netstart 5.9 (Berkeley) 3/30/91 29# 30 31# Note that almost all of the user-configurable behavior is no longer in 32# this file, but rather in /etc/defaults/rc.conf. Please check that file 33# first before contemplating any changes here. If you do need to change 34# this file for some reason, we would like to know about it. 35 36# First pass startup stuff. 37# 38network_pass1() { 39 echo -n 'Doing initial network setup:' 40 41 # Convert host.conf to nsswitch.conf if necessary 42 if [ -f "/etc/host.conf" ]; then 43 echo '' 44 echo 'Warning: /etc/host.conf is no longer used' 45 if [ -f "/etc/nsswitch.conf" ]; then 46 echo ' /etc/nsswitch.conf will be used instead' 47 else 48 echo ' /etc/nsswitch.conf will be created for you' 49 convert_host_conf /etc/host.conf /etc/nsswitch.conf 50 fi 51 fi 52 53 # Set the host name if it is not already set 54 # 55 if [ -z "`hostname -s`" ]; then 56 hostname ${hostname} 57 echo -n ' hostname' 58 fi 59 60 # Establish ipfilter ruleset as early as possible (best in 61 # addition to IPFILTER_DEFAULT_BLOCK in the kernel config file) 62 # 63 case "${ipfilter_enable}" in 64 [Yy][Ee][Ss]) 65 if [ -r "${ipfilter_rules}" ]; then 66 echo -n ' ipfilter'; 67 ${ipfilter_program:-/sbin/ipf -Fa -f} \ 68 "${ipfilter_rules}" ${ipfilter_flags} 69 case "${ipmon_enable}" in 70 [Yy][Ee][Ss]) 71 echo -n ' ipmon' 72 ${ipmon_program:-/sbin/ipmon} ${ipmon_flags} 73 ;; 74 esac 75 case "${ipnat_enable}" in 76 [Yy][Ee][Ss]) 77 if [ -r "${ipnat_rules}" ]; then 78 echo -n ' ipnat'; 79 eval ${ipnat_program:-/sbin/ipnat -CF -f} \ 80 "${ipnat_rules}" ${ipnat_flags} 81 else 82 echo -n ' NO IPNAT RULES' 83 fi 84 ;; 85 esac 86 else 87 ipfilter_enable="NO" 88 echo -n ' NO IPF RULES' 89 fi 90 ;; 91 esac 92 93 # Set the domainname if we're using NIS 94 # 95 case ${nisdomainname} in 96 [Nn][Oo] | '') 97 ;; 98 *) 99 domainname ${nisdomainname} 100 echo -n ' domain' 101 ;; 102 esac 103 104 echo '.' 105 106 # Initial ATM interface configuration 107 # 108 case ${atm_enable} in 109 [Yy][Ee][Ss]) 110 if [ -r /etc/rc.atm ]; then 111 . /etc/rc.atm 112 atm_pass1 113 fi 114 ;; 115 esac 116 117 # Special options for sppp(4) interfaces go here. These need 118 # to go _before_ the general ifconfig section, since in the case 119 # of hardwired (no link1 flag) but required authentication, you 120 # cannot pass auth parameters down to the already running interface. 121 # 122 for ifn in ${sppp_interfaces}; do 123 eval spppcontrol_args=\$spppconfig_${ifn} 124 if [ -n "${spppcontrol_args}" ]; then 125 # The auth secrets might contain spaces; in order 126 # to retain the quotation, we need to eval them 127 # here. 128 eval spppcontrol ${ifn} ${spppcontrol_args} 129 fi 130 done 131 132 # Set up all the network interfaces, calling startup scripts if needed 133 # 134 case ${network_interfaces} in 135 [Aa][Uu][Tt][Oo]) 136 network_interfaces="`ifconfig -l`" 137 ;; 138 esac 139 140 dhcp_interfaces="" 141 for ifn in ${network_interfaces}; do 142 if [ -r /etc/start_if.${ifn} ]; then 143 . /etc/start_if.${ifn} 144 eval showstat_$ifn=1 145 fi 146 147 # Do the primary ifconfig if specified 148 # 149 eval ifconfig_args=\$ifconfig_${ifn} 150 151 case ${ifconfig_args} in 152 '') 153 ;; 154 [Dd][Hh][Cc][Pp]) 155 # DHCP inits are done all in one go below 156 dhcp_interfaces="$dhcp_interfaces $ifn" 157 eval showstat_$ifn=1 158 ;; 159 *) 160 ifconfig ${ifn} ${ifconfig_args} 161 eval showstat_$ifn=1 162 ;; 163 esac 164 done 165 166 if [ ! -z "${dhcp_interfaces}" ]; then 167 ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} 168 fi 169 170 for ifn in ${network_interfaces}; do 171 # Check to see if aliases need to be added 172 # 173 alias=0 174 while : ; do 175 eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} 176 if [ -n "${ifconfig_args}" ]; then 177 ifconfig ${ifn} ${ifconfig_args} alias 178 eval showstat_$ifn=1 179 alias=`expr ${alias} + 1` 180 else 181 break; 182 fi 183 done 184 185 # Do ipx address if specified 186 # 187 eval ifconfig_args=\$ifconfig_${ifn}_ipx 188 if [ -n "${ifconfig_args}" ]; then 189 ifconfig ${ifn} ${ifconfig_args} 190 eval showstat_$ifn=1 191 fi 192 done 193 194 for ifn in ${network_interfaces}; do 195 eval showstat=\$showstat_${ifn} 196 if [ ! -z ${showstat} ]; then 197 ifconfig ${ifn} 198 fi 199 done 200 201 # ISDN subsystem startup 202 # 203 case ${isdn_enable} in 204 [Yy][Ee][Ss]) 205 if [ -r /etc/rc.isdn ]; then 206 . /etc/rc.isdn 207 fi 208 ;; 209 esac 210 211 # Start user ppp if required. This must happen before natd. 212 # 213 case ${ppp_enable} in 214 [Yy][Ee][Ss]) 215 # Establish ppp mode. 216 # 217 if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \ 218 -a "${ppp_mode}" != "dedicated" \ 219 -a "${ppp_mode}" != "background" ]; then 220 ppp_mode="auto" 221 fi 222 223 ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}" 224 225 # Switch on NAT mode? 226 # 227 case ${ppp_nat} in 228 [Yy][Ee][Ss]) 229 ppp_command="${ppp_command} -nat" 230 ;; 231 esac 232 233 ppp_command="${ppp_command} ${ppp_profile}" 234 235 echo -n "Starting ppp as \"${ppp_user}\"" 236 su -m ${ppp_user} -c "exec ${ppp_command}" 237 ;; 238 esac 239 240 # Initialize IP filtering using ipfw 241 # 242 if /sbin/ipfw -q flush > /dev/null 2>&1; then 243 firewall_in_kernel=1 244 else 245 firewall_in_kernel=0 246 fi 247 248 case ${firewall_enable} in 249 [Yy][Ee][Ss]) 250 if [ "${firewall_in_kernel}" -eq 0 ] && kldload ipfw; then 251 firewall_in_kernel=1 252 echo 'Kernel firewall module loaded' 253 elif [ "${firewall_in_kernel}" -eq 0 ]; then 254 echo 'Warning: firewall kernel module failed to load' 255 fi 256 ;; 257 esac 258 259 # Load the filters if required 260 # 261 case ${firewall_in_kernel} in 262 1) 263 if [ -z "${firewall_script}" ]; then 264 firewall_script=/etc/rc.firewall 265 fi 266 267 case ${firewall_enable} in 268 [Yy][Ee][Ss]) 269 if [ -r "${firewall_script}" ]; then 270 . "${firewall_script}" 271 echo -n 'Firewall rules loaded, starting divert daemons:' 272 273 # Network Address Translation daemon 274 # 275 case ${natd_enable} in 276 [Yy][Ee][Ss]) 277 if [ -n "${natd_interface}" ]; then 278 if echo ${natd_interface} | \ 279 grep -q -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then 280 natd_ifarg="-a ${natd_interface}" 281 else 282 natd_ifarg="-n ${natd_interface}" 283 fi 284 285 echo -n ' natd'; ${natd_program:-/sbin/natd} ${natd_flags} ${natd_ifarg} 286 fi 287 ;; 288 esac 289 290 echo '.' 291 292 elif [ "`ipfw l 65535`" = "65535 deny ip from any to any" ]; then 293 echo 'Warning: kernel has firewall functionality,' \ 294 'but firewall rules are not enabled.' 295 echo ' All ip services are disabled.' 296 fi 297 298 case ${firewall_logging} in 299 [Yy][Ee][Ss] | '') 300 echo 'Firewall logging=YES' 301 sysctl -w net.inet.ip.fw.verbose=1 >/dev/null 302 ;; 303 *) 304 ;; 305 esac 306 307 ;; 308 esac 309 ;; 310 esac 311 312 # Additional ATM interface configuration 313 # 314 if [ -n "${atm_pass1_done}" ]; then 315 atm_pass2 316 fi 317 318 # Configure routing 319 # 320 case ${defaultrouter} in 321 [Nn][Oo] | '') 322 ;; 323 *) 324 static_routes="default ${static_routes}" 325 route_default="default ${defaultrouter}" 326 ;; 327 esac 328 329 # Set up any static routes. This should be done before router discovery. 330 # 331 if [ -n "${static_routes}" ]; then 332 for i in ${static_routes}; do 333 eval route_args=\$route_${i} 334 route add ${route_args} 335 done 336 fi 337 338 echo -n 'Additional routing options:' 339 case ${tcp_extensions} in 340 [Yy][Ee][Ss] | '') 341 ;; 342 *) 343 echo -n ' tcp extensions=NO' 344 sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 345 ;; 346 esac 347 348 case ${icmp_bmcastecho} in 349 [Yy][Ee][Ss]) 350 echo -n ' broadcast ping responses=YES' 351 sysctl -w net.inet.icmp.bmcastecho=1 >/dev/null 352 ;; 353 esac 354 355 case ${icmp_drop_redirect} in 356 [Yy][Ee][Ss]) 357 echo -n ' ignore ICMP redirect=YES' 358 sysctl -w net.inet.icmp.drop_redirect=1 >/dev/null 359 ;; 360 esac 361 362 case ${icmp_log_redirect} in 363 [Yy][Ee][Ss]) 364 echo -n ' log ICMP redirect=YES' 365 sysctl -w net.inet.icmp.log_redirect=1 >/dev/null 366 ;; 367 esac 368 369 case ${gateway_enable} in 370 [Yy][Ee][Ss]) 371 echo -n ' IP gateway=YES' 372 sysctl -w net.inet.ip.forwarding=1 >/dev/null 373 ;; 374 esac 375 376 case ${forward_sourceroute} in 377 [Yy][Ee][Ss]) 378 echo -n ' do source routing=YES' 379 sysctl -w net.inet.ip.sourceroute=1 >/dev/null 380 ;; 381 esac 382 383 case ${accept_sourceroute} in 384 [Yy][Ee][Ss]) 385 echo -n ' accept source routing=YES' 386 sysctl -w net.inet.ip.accept_sourceroute=1 >/dev/null 387 ;; 388 esac 389 390 case ${tcp_keepalive} in 391 [Yy][Ee][Ss]) 392 echo -n ' TCP keepalive=YES' 393 sysctl -w net.inet.tcp.always_keepalive=1 >/dev/null 394 ;; 395 esac 396 397 case ${tcp_restrict_rst} in 398 [Yy][Ee][Ss]) 399 echo -n ' restrict TCP reset=YES' 400 sysctl -w net.inet.tcp.restrict_rst=1 >/dev/null 401 ;; 402 esac 403 404 case ${tcp_drop_synfin} in 405 [Yy][Ee][Ss]) 406 echo -n ' drop SYN+FIN packets=YES' 407 sysctl -w net.inet.tcp.drop_synfin=1 >/dev/null 408 ;; 409 esac 410 411 case ${ipxgateway_enable} in 412 [Yy][Ee][Ss]) 413 echo -n ' IPX gateway=YES' 414 sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 415 ;; 416 esac 417 418 case ${arpproxy_all} in 419 [Yy][Ee][Ss]) 420 echo -n ' ARP proxyall=YES' 421 sysctl -w net.link.ether.inet.proxyall=1 >/dev/null 422 ;; 423 esac 424 425 case ${ip_portrange_first} in 426 [Nn][Oo] | '') 427 ;; 428 *) 429 echo -n " ip_portrange_first=$ip_portrange_first" 430 sysctl -w net.inet.ip.portrange.first=$ip_portrange_first >/dev/null 431 ;; 432 esac 433 434 case ${ip_portrange_last} in 435 [Nn][Oo] | '') 436 ;; 437 *) 438 echo -n " ip_portrange_last=$ip_portrange_last" 439 sysctl -w net.inet.ip.portrange.last=$ip_portrange_last >/dev/null 440 ;; 441 esac 442 443 echo '.' 444 445 case ${ipsec_enable} in 446 [Yy][Ee][Ss]) 447 if [ -f ${ipsec_file} ]; then 448 echo ' ipsec: enabled' 449 setkey -f ${ipsec_file} 450 else 451 echo ' ipsec: file not found' 452 fi 453 ;; 454 esac 455 456 echo -n 'Routing daemons:' 457 case ${router_enable} in 458 [Yy][Ee][Ss]) 459 echo -n " ${router}"; ${router} ${router_flags} 460 ;; 461 esac 462 463 case ${ipxrouted_enable} in 464 [Yy][Ee][Ss]) 465 echo -n ' IPXrouted' 466 IPXrouted ${ipxrouted_flags} > /dev/null 2>&1 467 ;; 468 esac 469 470 case ${mrouted_enable} in 471 [Yy][Ee][Ss]) 472 echo -n ' mrouted'; mrouted ${mrouted_flags} 473 ;; 474 esac 475 476 case ${rarpd_enable} in 477 [Yy][Ee][Ss]) 478 echo -n ' rarpd'; rarpd ${rarpd_flags} 479 ;; 480 esac 481 echo '.' 482 483 # Let future generations know we made it. 484 # 485 network_pass1_done=YES 486} 487 488network_pass2() { 489 echo -n 'Doing additional network setup:' 490 case ${named_enable} in 491 [Yy][Ee][Ss]) 492 echo -n ' named'; ${named_program:-named} ${named_flags} 493 ;; 494 esac 495 496 case ${ntpdate_enable} in 497 [Yy][Ee][Ss]) 498 echo -n ' ntpdate' 499 ${ntpdate_program:-ntpdate} ${ntpdate_flags} >/dev/null 2>&1 500 ;; 501 esac 502 503 case ${xntpd_enable} in 504 [Yy][Ee][Ss]) 505 echo -n ' ntpd'; ${xntpd_program:-ntpd} ${xntpd_flags} 506 ;; 507 esac 508 509 case ${timed_enable} in 510 [Yy][Ee][Ss]) 511 echo -n ' timed'; timed ${timed_flags} 512 ;; 513 esac 514 515 case ${portmap_enable} in 516 [Yy][Ee][Ss]) 517 echo -n ' rpcbind'; ${portmap_program:-/usr/sbin/rpcbind} \ 518 ${portmap_flags} 519 520 # Start ypserv if we're an NIS server. 521 # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server. 522 # 523 case ${nis_server_enable} in 524 [Yy][Ee][Ss]) 525 echo -n ' ypserv'; ypserv ${nis_server_flags} 526 527 case ${nis_ypxfrd_enable} in 528 [Yy][Ee][Ss]) 529 echo -n ' rpc.ypxfrd' 530 rpc.ypxfrd ${nis_ypxfrd_flags} 531 ;; 532 esac 533 534 case ${nis_yppasswdd_enable} in 535 [Yy][Ee][Ss]) 536 echo -n ' rpc.yppasswdd' 537 rpc.yppasswdd ${nis_yppasswdd_flags} 538 ;; 539 esac 540 ;; 541 esac 542 543 # Start ypbind if we're an NIS client 544 # 545 case ${nis_client_enable} in 546 [Yy][Ee][Ss]) 547 echo -n ' ypbind'; ypbind ${nis_client_flags} 548 case ${nis_ypset_enable} in 549 [Yy][Ee][Ss]) 550 echo -n ' ypset'; ypset ${nis_ypset_flags} 551 ;; 552 esac 553 ;; 554 esac 555 556 # Start keyserv if we are running Secure RPC 557 # 558 case ${keyserv_enable} in 559 [Yy][Ee][Ss]) 560 echo -n ' keyserv'; keyserv ${keyserv_flags} 561 ;; 562 esac 563 564 # Start ypupdated if we are running Secure RPC 565 # and we are NIS master 566 # 567 case ${rpc_ypupdated_enable} in 568 [Yy][Ee][Ss]) 569 echo -n ' rpc.ypupdated'; rpc.ypupdated 570 ;; 571 esac 572 ;; 573 esac 574 575 # Start ATM daemons 576 if [ -n "${atm_pass2_done}" ]; then 577 atm_pass3 578 fi 579 580 echo '.' 581 network_pass2_done=YES 582} 583 584network_pass3() { 585 echo -n 'Starting final network daemons:' 586 587 case ${portmap_enable} in 588 [Yy][Ee][Ss]) 589 case ${nfs_server_enable} in 590 [Yy][Ee][Ss]) 591 if [ -r /etc/exports ]; then 592 echo -n ' mountd' 593 594 case ${weak_mountd_authentication} in 595 [Yy][Ee][Ss]) 596 mountd_flags="${mountd_flags} -n" 597 ;; 598 esac 599 600 mountd ${mountd_flags} 601 602 case ${nfs_reserved_port_only} in 603 [Yy][Ee][Ss]) 604 echo -n ' NFS on reserved port only=YES' 605 sysctl -w vfs.nfs.nfs_privport=1 > /dev/null 606 ;; 607 esac 608 609 echo -n ' nfsd'; nfsd ${nfs_server_flags} 610 611 if [ -n "${nfs_bufpackets}" ]; then 612 sysctl -w vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null 613 fi 614 615 case ${rpc_lockd_enable} in 616 [Yy][Ee][Ss]) 617 echo -n ' rpc.lockd'; rpc.lockd 618 ;; 619 esac 620 621 case ${rpc_statd_enable} in 622 [Yy][Ee][Ss]) 623 echo -n ' rpc.statd'; rpc.statd 624 ;; 625 esac 626 fi 627 ;; 628 *) 629 case ${single_mountd_enable} in 630 [Yy][Ee][Ss]) 631 if [ -r /etc/exports ]; then 632 echo -n ' mountd' 633 634 case ${weak_mountd_authentication} in 635 [Yy][Ee][Ss]) 636 mountd_flags="-n" 637 ;; 638 esac 639 640 mountd ${mountd_flags} 641 fi 642 ;; 643 esac 644 ;; 645 esac 646 647 case ${nfs_client_enable} in 648 [Yy][Ee][Ss]) 649 echo -n ' nfsiod'; nfsiod ${nfs_client_flags} 650 if [ -n "${nfs_access_cache}" ]; then 651 echo -n " NFS access cache time=${nfs_access_cache}" 652 sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null 653 fi 654 ;; 655 esac 656 657 # If /var/db/mounttab exists, some nfs-server has not been 658 # sucessfully notified about a previous client shutdown. 659 # If there is no /var/db/mounttab, we do nothing. 660 if [ -f /var/db/mounttab ]; then 661 rpc.umntall -k 662 fi 663 664 case ${amd_enable} in 665 [Yy][Ee][Ss]) 666 echo -n ' amd' 667 case ${amd_map_program} in 668 [Nn][Oo] | '') 669 ;; 670 *) 671 amd_flags="${amd_flags} `eval\ 672 ${amd_map_program}`" 673 ;; 674 esac 675 676 if [ -n "${amd_flags}" ]; then 677 amd -p ${amd_flags}\ 678 > /var/run/amd.pid 2> /dev/null 679 else 680 amd 2> /dev/null 681 fi 682 ;; 683 esac 684 ;; 685 esac 686 687 case ${rwhod_enable} in 688 [Yy][Ee][Ss]) 689 echo -n ' rwhod'; rwhod ${rwhod_flags} 690 ;; 691 esac 692 693 # Kerberos runs ONLY on the Kerberos server machine 694 case ${kerberos_server_enable} in 695 [Yy][Ee][Ss]) 696 case ${kerberos_stash} in 697 [Yy][Ee][Ss]) 698 stash_flag=-n 699 ;; 700 *) 701 stash_flag= 702 ;; 703 esac 704 705 echo -n ' kerberos' 706 kerberos ${stash_flag} >> /var/log/kerberos.log & 707 708 case ${kadmind_server_enable} in 709 [Yy][Ee][Ss]) 710 echo -n ' kadmind' 711 (sleep 20; kadmind ${stash_flag} >/dev/null 2>&1 &) & 712 ;; 713 esac 714 unset stash_flag 715 ;; 716 esac 717 718 case ${pppoed_enable} in 719 [Yy][Ee][Ss]) 720 if [ -n "${pppoed_provider}" ]; then 721 pppoed_flags="${pppoed_flags} -p ${pppoed_provider}" 722 fi 723 echo -n ' pppoed'; 724 /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface} 725 ;; 726 esac 727 728 case ${sshd_enable} in 729 [Yy][Ee][Ss]) 730 if [ ! -f /etc/ssh/ssh_host_key ]; then 731 echo ' creating ssh RSA host key'; 732 /usr/bin/ssh-keygen -N "" -f /etc/ssh/ssh_host_key 733 fi 734 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then 735 echo ' creating ssh DSA host key'; 736 /usr/bin/ssh-keygen -d -N "" -f /etc/ssh/ssh_host_dsa_key 737 fi 738 ;; 739 esac 740 741 echo '.' 742 network_pass3_done=YES 743} 744 745network_pass4() { 746 echo -n 'Additional TCP options:' 747 case ${log_in_vain} in 748 [Nn][Oo] | '') 749 ;; 750 *) 751 echo -n ' log_in_vain=YES' 752 sysctl -w net.inet.tcp.log_in_vain=1 >/dev/null 753 sysctl -w net.inet.udp.log_in_vain=1 >/dev/null 754 ;; 755 esac 756 757 echo '.' 758 network_pass4_done=YES 759} 760 761convert_host_conf() { 762 host_conf=$1; shift; 763 nsswitch_conf=$1; shift; 764 awk ' \ 765 /^[:blank:]*#/ { next } \ 766 /(hosts|local|file)/ { nsswitch[c] = "files"; c++; next } \ 767 /(dns|bind)/ { nsswitch[c] = "dns"; c++; next } \ 768 /nis/ { nsswitch[c] = "nis"; c++; next } \ 769 { printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \ 770 END { \ 771 printf "hosts: "; \ 772 for (i in nsswitch) printf "%s ", nsswitch[i]; \ 773 printf "\n"; \ 774 }' < $host_conf > $nsswitch_conf 775} 776 777