Browse code

default gateway regex: use exact match for iface name

If the current interface has a default gateway configured is
determined by the regex

default.+<interface-name>

If for example 'enc1' is used, but also an interface 'enc1800' is
present, the regex will also match the 'enc1800' default gateway.

This patch fixes this by looking for <interface-name><white-space>.
This way 'enc1800' is not matched.

Change-Id: Id1d58f5be6296c3a37aef788359ae8fe0fe11d8b

Andreas Scheuring authored on 2017/04/26 20:40:42
Showing 1 changed files
... ...
@@ -570,7 +570,7 @@ function _move_neutron_addresses_route {
570 570
         local IP_DEL=""
571 571
         local IP_UP=""
572 572
         local DEFAULT_ROUTE_GW
573
-        DEFAULT_ROUTE_GW=$(ip -f $af r | awk "/default.+$from_intf/ { print \$3; exit }")
573
+        DEFAULT_ROUTE_GW=$(ip -f $af r | awk "/default.+$from_intf\s/ { print \$3; exit }")
574 574
         local ADD_OVS_PORT=""
575 575
         local DEL_OVS_PORT=""
576 576
         local ARP_CMD=""