diff options
author | Kristóf Marussy <kris7topher@gmail.com> | 2019-12-26 20:58:39 +0100 |
---|---|---|
committer | Kristóf Marussy <kris7topher@gmail.com> | 2019-12-30 02:38:59 +0100 |
commit | 40d6081485d6f3e39f325cede1cef48f225c9cdc (patch) | |
tree | bde46dae15e2b908266e71aa648e8c7eb5dcbc35 /src | |
parent | Add --ip=dhcp and --ip6=dhcp options (diff) | |
download | firejail-40d6081485d6f3e39f325cede1cef48f225c9cdc.tar.gz firejail-40d6081485d6f3e39f325cede1cef48f225c9cdc.tar.zst firejail-40d6081485d6f3e39f325cede1cef48f225c9cdc.zip |
Do not try to set up default gateway without an IP address
If the container has no IP address (because it will be assigned via DHCP later),
setting up a default route fails with a warning message.
While this is harmless, the default route should be omitted instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/network_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/firejail/network_main.c b/src/firejail/network_main.c index 6800bde8d..ad297efc7 100644 --- a/src/firejail/network_main.c +++ b/src/firejail/network_main.c | |||
@@ -246,6 +246,10 @@ void net_check_cfg(void) { | |||
246 | if (cfg.defaultgw) | 246 | if (cfg.defaultgw) |
247 | check_default_gw(cfg.defaultgw); | 247 | check_default_gw(cfg.defaultgw); |
248 | else { | 248 | else { |
249 | // if the first network has no assigned address, | ||
250 | // do not try to set up a gateway, because it will fail | ||
251 | if (cfg.bridge0.arg_ip_none) | ||
252 | return; | ||
249 | // first network is a regular bridge | 253 | // first network is a regular bridge |
250 | if (cfg.bridge0.macvlan == 0) | 254 | if (cfg.bridge0.macvlan == 0) |
251 | cfg.defaultgw = cfg.bridge0.ip; | 255 | cfg.defaultgw = cfg.bridge0.ip; |