Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1015,21 +1015,21 @@ public boolean configure(final String name, final Map<String, Object> params) th
*/

if (_pifs.get("private") == null) {
s_logger.debug("Failed to get private nic name");
s_logger.error("Failed to get private nic name");
throw new ConfigurationException("Failed to get private nic name");
}

if (_pifs.get("public") == null) {
s_logger.debug("Failed to get public nic name");
s_logger.error("Failed to get public nic name");
throw new ConfigurationException("Failed to get public nic name");
}
s_logger.debug("Found pif: " + _pifs.get("private") + " on " + _privBridgeName + ", pif: " + _pifs.get("public") + " on " + _publicBridgeName);

_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}'");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ip route show default | ... was sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

if (_localGateway == null) {
s_logger.debug("Failed to found the local gateway");
s_logger.warn("No default IPv4 gateway found");
}

_mountPoint = (String)params.get("mount.path");
Expand Down