Consolidate two /sbin/ip commands into a single one
When determining the primary IP/IPv6 addresses on a system, we can use the /sbin/ip command to filter them for us. The resulting address is parsed the same way for both address families, so we can use just a single command. Change-Id: I0471ff5a258a16a23061941ac38063dbf3d7c233
This commit is contained in:
parent
fa8464bf34
commit
bb9caeae00
@ -801,13 +801,7 @@ function _move_neutron_addresses_route {
|
||||
DEFAULT_ROUTE_GW=$(ip -f $af r | awk "/default.+$from_intf/ { print \$3; exit }")
|
||||
local ADD_OVS_PORT=""
|
||||
|
||||
if [[ $af == "inet" ]]; then
|
||||
IP_BRD=$(ip -f $af a s dev $from_intf | grep inet | awk '{ print $2, $3, $4; exit }')
|
||||
fi
|
||||
|
||||
if [[ $af == "inet6" ]]; then
|
||||
IP_BRD=$(ip -f $af a s dev $from_intf | grep 'scope global' | sed '/temporary/d' | awk '{ print $2, $3, $4; exit }')
|
||||
fi
|
||||
IP_BRD=$(ip -f $af a s dev $from_intf scope global primary | grep inet | awk '{ print $2, $3, $4; exit }')
|
||||
|
||||
if [ "$DEFAULT_ROUTE_GW" != "" ]; then
|
||||
ADD_DEFAULT_ROUTE="sudo ip -f $af r replace default via $DEFAULT_ROUTE_GW dev $to_intf"
|
||||
|
Loading…
x
Reference in New Issue
Block a user