Repository navigation
kvm: Use 'ip route show default 0.0.0.0/0' to find the default gateway - #3080
Conversation
If a host has many routes this can be a magnitude faster then printing all the routes and grepping for the default. In some situations the host might have a large amount of routes due to dynamic routing being used like OSPF or BGP. In addition fix a couple of loglines which were throwing messages on DEBUG while WARN and ERROR should be used there. Signed-off-by: Wido den Hollander <wido@widodh.nl>
| _canBridgeFirewall = canBridgeFirewall(_pifs.get("public")); | ||
|
|
||
| _localGateway = Script.runSimpleBashScript("ip route |grep default|awk '{print $3}'"); | ||
| _localGateway = Script.runSimpleBashScript("ip route show default 0.0.0.0/0|head -1|awk '{print $3}'"); |
There was a problem hiding this comment.
I think ip route show default | ... was sufficient.
There was a problem hiding this comment.
That still prints additional lines, for example:
wido@n01:~$ ip route show default 0.0.0.0/0|wc -l 1 wido@n01:~$ ip route show default|wc -l 22 wido@n01:~$
We only want to know the route for 0.0.0.0/0 and not other more specific routes set in the routing table.
yadvr
left a comment
There was a problem hiding this comment.
LGTM, minor comment raised to drop the 0.0.0.0/0 but okay if code is put as it is.
|
@wido feel free to use blueorangutan to package yourself |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2483 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
GabrielBrascher
left a comment
There was a problem hiding this comment.
Code LGTM, thanks @wido.
|
Trillian test result (tid-3250)
|
If a host has many routes this can be a magnitude faster then printing
all the routes and grepping for the default.
In some situations the host might have a large amount of routes due to
dynamic routing being used like OSPF or BGP.
In addition fix a couple of loglines which were throwing messages on
DEBUG while WARN and ERROR should be used there.
Signed-off-by: Wido den Hollander wido@widodh.nl
Description
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?