Fix ifconfig using some iproute2 commands.

This commit is contained in:
Roy Marples 2007-07-10 15:07:18 +00:00
parent 7bb24d8058
commit 3fc53d1979

View File

@ -141,14 +141,23 @@ _add_address() {
set -- "${ip}" netmask "${netmask}" "$@" set -- "${ip}" netmask "${netmask}" "$@"
fi fi
# # Support iproute2 style config where possible local arg= cmd=
# r="${config[@]}" while [ -n "$1" ] ; do
# config=( ${r//brd +/} ) case "$1" in
# config=( "${config[@]//brd/broadcast}" ) brd)
# config=( "${config[@]//peer/pointopoint}" ) if [ "$2" = "+" ] ; then
# fi shift
else
cmd="${cmd} broadcast"
fi
;;
peer) cmd="${cmd} pointtopoint";;
*) cmd="${cmd} $1" ;;
esac
shift
done
ifconfig "${iface}" "$@" ifconfig "${iface}" ${cmd}
} }
_add_route() { _add_route() {
@ -180,15 +189,14 @@ _delete_addresses() {
# as we delete an address, a new one appears, so we have to # as we delete an address, a new one appears, so we have to
# keep polling # keep polling
while true ; do while true ; do
local addr=$(LC_ALL=C ifconfig "${IFACE}" | local addr=$(_get_inet_address)
sed -n -e 's/.*inet addr:\([^ ]*\).*/\1/p')
[ -z "${addr}" ] && break [ -z "${addr}" ] && break
if [ "${addr}" = "127.0.0.1/8" ] ; then if [ "${addr}" = "127.0.0.1/8" ] ; then
# Don't delete the loopback address # Don't delete the loopback address
[ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break
fi fi
einfo "${addr}"
ifconfig "${IFACE}" 0.0.0.0 || break ifconfig "${IFACE}" 0.0.0.0 || break
done done