Changeset View
Changeset View
Standalone View
Standalone View
head/etc/rc.d/jail
Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | jail_extract_address() | ||||
# Theoretically we can return here if interface is not set, | # Theoretically we can return here if interface is not set, | ||||
# as we only care about the _mask if we call ifconfig. | # as we only care about the _mask if we call ifconfig. | ||||
# This is not done because we may want to santize IP addresses | # This is not done because we may want to santize IP addresses | ||||
# based on _type later, and optionally change the type as well. | # based on _type later, and optionally change the type as well. | ||||
# Extract the prefix/netmask/prefixlen part by cutting off the address. | # Extract the prefix/netmask/prefixlen part by cutting off the address. | ||||
_mask=${_r} | _mask=${_r} | ||||
_mask=`expr "${_mask}" : "${_addr}\(.*\)"` | _mask=`expr -- "${_mask}" : "${_addr}\(.*\)"` | ||||
# Identify type {inet,inet6}. | # Identify type {inet,inet6}. | ||||
case "${_addr}" in | case "${_addr}" in | ||||
*\.*\.*\.*) _type="inet" ;; | *\.*\.*\.*) _type="inet" ;; | ||||
*:*) _type="inet6" ;; | *:*) _type="inet6" ;; | ||||
*) warn "jail_extract_address: type not identified" | *) warn "jail_extract_address: type not identified" | ||||
;; | ;; | ||||
esac | esac | ||||
Show All 33 Lines | if [ -z "${_x}" ]; then | ||||
return | return | ||||
fi | fi | ||||
# Loop, in case we find a comma separated list, we need to handle | # Loop, in case we find a comma separated list, we need to handle | ||||
# each argument on its own. | # each argument on its own. | ||||
while [ ${#_x} -gt 0 ]; do | while [ ${#_x} -gt 0 ]; do | ||||
case "${_x}" in | case "${_x}" in | ||||
*,*) # Extract the first argument and strip it off the list. | *,*) # Extract the first argument and strip it off the list. | ||||
_i=`expr "${_x}" : '^\([^,]*\)'` | _i=`expr -- "${_x}" : '^\([^,]*\)'` | ||||
_x=`expr "${_x}" : "^[^,]*,\(.*\)"` | _x=`expr -- "${_x}" : "^[^,]*,\(.*\)"` | ||||
;; | ;; | ||||
*) _i=${_x} | *) _i=${_x} | ||||
_x="" | _x="" | ||||
;; | ;; | ||||
esac | esac | ||||
_type="" | _type="" | ||||
_addr="" | _addr="" | ||||
▲ Show 20 Lines • Show All 223 Lines • Show Last 20 Lines |