16 local ipaddr=$1 netmask=$2 oifs=${IFS} mask=255
17 local ipb1 ipb2 ipb3 ipb4 nmb1 nmb2 nmb3 nmb4
19 set -- ${ipaddr}; ipb1=${1}; ipb2=${2}; ipb3=${3}; ipb4=${4}
20 set -- ${netmask}; nmb1=${1}; nmb2=${2}; nmb3=${3}; nmb4=${4}
24 network=$(($ipb1 & $nmb1)).$(($ipb2 & $nmb2)).$(($ipb3 & $nmb3)).$(($ipb4 & $nmb4))
25 bcast=$(($ipb1 | ($mask ^ $nmb1))).$(($ipb2 | ($mask ^ $nmb2))).$(($ipb3 | ($mask ^ $nmb3))).$(($ipb4 | ($mask ^ $nmb4)))
27 _RET_NETWORK=${network}
32 file=${2:-/etc/network/interfaces}
33 [ "$file" = "-" ] || exec <"$file"
39 line=${line%%${hash}*}
40 [ -n "$line" ] || continue
43 auto) [ "$2" = "$iface" ] && ENABLE=yes;;
45 [ "$2" = "$iface" ] || continue;
46 # if its not static, let the default path handle
47 [ "$4" = "static" ] || { DHCP=yes; continue; }
52 [ "$cur_iface" = "$iface" ] || continue;
54 address) IPADDRESS=${2};;
55 netmask) NETMASK=${2};;
56 gateway) GATEWAY=${2};;
57 address) IPADDRESS=${2};;
63 [ -n "$IPADDRESS" -a -n "$NETMASK" ] && netinfo "$IPADDRESS" "$NETMASK" &&
64 BROADCAST=${_RET_BCAST}
67 # this file was written by: $0 $iface $file
68 # some short experimentation shows that you must define
69 # ENABLE NAME CIDRLEN NETWORK and DHCP to get working DHCP
77 # the following are not set right, but not believed to matter