Deleted Added
full compact
network.subr (163759) network.subr (166583)
1#
2# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23# SUCH DAMAGE.
24#
1#
2# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23# SUCH DAMAGE.
24#
25# $FreeBSD: head/etc/network.subr 163759 2006-10-29 13:29:49Z mlaier $
25# $FreeBSD: head/etc/network.subr 166583 2007-02-09 12:11:27Z flz $
26#
27
28#
29# Subroutines commonly used from network startup scripts.
30# Requires that rc.conf be loaded first.
31#
32
33# ifconfig_up if

--- 416 unchanged lines hidden (view full) ---

450 if [ $? -eq 0 ]; then
451 _list="${_list}${_prefix}${ifn}"
452 [ -z "$_prefix" ] && _prefix=' '
453 fi
454 done
455 debug "Destroyed clones: ${_list}"
456}
457
26#
27
28#
29# Subroutines commonly used from network startup scripts.
30# Requires that rc.conf be loaded first.
31#
32
33# ifconfig_up if

--- 416 unchanged lines hidden (view full) ---

450 if [ $? -eq 0 ]; then
451 _list="${_list}${_prefix}${ifn}"
452 [ -z "$_prefix" ] && _prefix=' '
453 fi
454 done
455 debug "Destroyed clones: ${_list}"
456}
457
458# Create netgraph nodes.
459#
460ng_mkpeer() {
461 ngctl -f - 2> /dev/null <<EOF
462mkpeer $*
463msg dummy nodeinfo
464EOF
465}
466
467ng_create_one() {
468 ng_mkpeer $* | while read line; do
469 t=`expr "${line}" : '.* name="\([a-z]*[0-9]*\)" .*'`
470 if [ -n "${t}" ]; then
471 echo ${t}
472 return
473 fi
474 done
475}
476
458gif_up() {
477gif_up() {
478 # The following must be removed once RELENG_7 is branched.
459 case ${gif_interfaces} in
479 case ${gif_interfaces} in
460 [Nn][Oo] | '')
480 [Nn][Oo])
481 warn "gif_interfaces=\"NO\" is deprecated, use gif_interfaces=\"\" instead."
482 gif_interfaces=""
461 ;;
483 ;;
462 *)
463 for i in ${gif_interfaces}; do
464 peers=`get_if_var $i gifconfig_IF`
465 case ${peers} in
484 esac
485
486 for i in ${gif_interfaces}; do
487 peers=`get_if_var $i gifconfig_IF`
488 case ${peers} in
489 '')
490 continue
491 ;;
492 *)
493 ifconfig $i create >/dev/null 2>&1
494 ifconfig $i tunnel ${peers}
495 ifconfig $i up
496 ;;
497 esac
498 done
499}
500
501# ng_fec_create ifn
502# Configure Fast EtherChannel for interface $ifn. Returns 0 if FEC
503# arguments were found and configured; returns !0 otherwise.
504ng_fec_create() {
505 local req_iface iface bogus
506 req_iface="$1"
507
508 ngctl shutdown ${req_iface}: > /dev/null 2>&1
509
510 bogus=""
511 while true; do
512 iface=`ng_create_one fec dummy fec`
513 if [ -z "${iface}" ]; then
514 exit 2
515 fi
516 if [ "${iface}" = "${req_iface}" ]; then
517 break
518 fi
519 bogus="${bogus} ${iface}"
520 done
521
522 for iface in ${bogus}; do
523 ngctl shutdown ${iface}:
524 done
525}
526
527fec_up() {
528 for i in ${fec_interfaces}; do
529 ng_fec_create $i
530 for j in `get_if_var $i fecconfig_IF`; do
531 case ${j} in
466 '')
467 continue
468 ;;
469 *)
532 '')
533 continue
534 ;;
535 *)
470 ifconfig $i create >/dev/null 2>&1
471 ifconfig $i tunnel ${peers}
472 ifconfig $i up
536 ngctl msg ${i}: add_iface "\"${j}\""
473 ;;
474 esac
475 done
537 ;;
538 esac
539 done
476 ;;
477 esac
540 done
478}
479
480#
481# ipx_up ifn
482# Configure any IPX addresses for interface $ifn. Returns 0 if IPX
483# arguments were found and configured; returns 1 otherwise.
484#
485ipx_up()

--- 424 unchanged lines hidden ---
541}
542
543#
544# ipx_up ifn
545# Configure any IPX addresses for interface $ifn. Returns 0 if IPX
546# arguments were found and configured; returns 1 otherwise.
547#
548ipx_up()

--- 424 unchanged lines hidden ---