ip.bash: fix route syntax on freebsd/macosx
This commit is contained in:
parent
8d077a2107
commit
dd27333906
@ -11,8 +11,8 @@ add_ip6(){
|
|||||||
if has ip; then
|
if has ip; then
|
||||||
_add_ip_linux "$ip" "$prefixlen" "$interface"
|
_add_ip_linux "$ip" "$prefixlen" "$interface"
|
||||||
elif has ifconfig; then
|
elif has ifconfig; then
|
||||||
ifconfig "$interface" inet6 del "$ip" prefixlen "$prefixlen" || true
|
ifconfig "$interface" inet6 "$ip" prefixlen "$prefixlen" delete || true
|
||||||
ifconfig "$interface" inet6 add "$ip" prefixlen "$prefixlen"
|
ifconfig "$interface" inet6 "$ip" prefixlen "$prefixlen" add
|
||||||
else
|
else
|
||||||
die "no suitable program found to configure the network interface, need iproute2 or ifconfig"
|
die "no suitable program found to configure the network interface, need iproute2 or ifconfig"
|
||||||
fi
|
fi
|
||||||
@ -26,8 +26,8 @@ add_ip4() {
|
|||||||
local cidr="$(mask2cidr $netmask)"
|
local cidr="$(mask2cidr $netmask)"
|
||||||
_add_ip_linux "$ip" "$cidr" "$interface"
|
_add_ip_linux "$ip" "$cidr" "$interface"
|
||||||
elif has ifconfig; then
|
elif has ifconfig; then
|
||||||
ifconfig "$interface" del "$ip" netmask "$netmask" || true
|
ifconfig "$interface" "$ip" netmask "$netmask" delete || true
|
||||||
ifconfig "$interface" add "$ip" netmask "$netmask"
|
ifconfig "$interface" "$ip" netmask "$netmask" add
|
||||||
else
|
else
|
||||||
die "no suitable program found to set ip address, need iproute2 or ifconfig"
|
die "no suitable program found to set ip address, need iproute2 or ifconfig"
|
||||||
fi
|
fi
|
||||||
@ -37,4 +37,3 @@ _add_ip_linux() {
|
|||||||
ip addr del "$1/$2" dev "$3" || true
|
ip addr del "$1/$2" dev "$3" || true
|
||||||
ip addr add "$1/$2" dev "$3"
|
ip addr add "$1/$2" dev "$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user