network.subr (134429) | network.subr (137070) |
---|---|
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 134429 2004-08-28 07:58:02Z yar $ | 25# $FreeBSD: head/etc/network.subr 137070 2004-10-30 13:44:06Z pjd $ |
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 --- 211 unchanged lines hidden (view full) --- 245 IFS="$_ifs" 246 _ret=0 247 done 248 IFS="$oldifs" 249 250 return $_ret 251} 252 | 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 --- 211 unchanged lines hidden (view full) --- 245 IFS="$_ifs" 246 _ret=0 247 done 248 IFS="$oldifs" 249 250 return $_ret 251} 252 |
253# ifnet_rename 254# Rename all requested interfaces. |
|
253# | 255# |
256ifnet_rename() 257{ 258 259 _ifn_list="`list_net_interfaces all`" 260 [ -z "$_ifn_list" ] && return 0 261 for _if in ${_ifn_list} ; do 262 eval _ifname=\$ifconfig_${_if}_name 263 if [ ! -z "$_ifname" ]; then 264 ifconfig $_if name $_ifname 265 fi 266 done 267 return 0 268} 269 270# |
|
254# list_net_interfaces type 255# List all network interfaces. The type of interface returned 256# can be controlled by the type argument. The type 257# argument can be any of the following: 258# nodhcp - all interfaces, excluding DHCP configured interfaces 259# dhcp - list only DHCP configured interfaces | 271# list_net_interfaces type 272# List all network interfaces. The type of interface returned 273# can be controlled by the type argument. The type 274# argument can be any of the following: 275# nodhcp - all interfaces, excluding DHCP configured interfaces 276# dhcp - list only DHCP configured interfaces |
277# all - all interfaces |
|
260# If no argument is specified all network interfaces are output. 261# Note that the list will include cloned interfaces if applicable. 262# Cloned interfaces must already exist to have a chance to appear 263# in the list if ${network_interfaces} is set to `auto'. 264# 265list_net_interfaces() 266{ 267 type=$1 --- 52 unchanged lines hidden (view full) --- 320 321 case "$type" in 322 nodhcp) 323 echo $_nodhcplist 324 ;; 325 dhcp) 326 echo $_dhcplist 327 ;; | 278# If no argument is specified all network interfaces are output. 279# Note that the list will include cloned interfaces if applicable. 280# Cloned interfaces must already exist to have a chance to appear 281# in the list if ${network_interfaces} is set to `auto'. 282# 283list_net_interfaces() 284{ 285 type=$1 --- 52 unchanged lines hidden (view full) --- 338 339 case "$type" in 340 nodhcp) 341 echo $_nodhcplist 342 ;; 343 dhcp) 344 echo $_dhcplist 345 ;; |
346 all) 347 echo $_nodhcplist $_dhcplist 348 ;; |
|
328 esac 329 return 0 330} 331 332hexdigit() 333{ 334 if [ $1 -lt 10 ]; then 335 echo $1 --- 291 unchanged lines hidden --- | 349 esac 350 return 0 351} 352 353hexdigit() 354{ 355 if [ $1 -lt 10 ]; then 356 echo $1 --- 291 unchanged lines hidden --- |