changing a gateway can fail if there is an old conflicting route. this can happen when changing gateways back and forth. with this change all old routes that are no longer relevant are deleted after a change.
Signed-off-by: David Limbeck <d.limb...@proxmox.com> --- src/PVE/LXC.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 1504bd0..4d9f5b0 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -791,6 +791,7 @@ sub update_ipconfig { my $newip = $newnet->{$ip}; my $newgw = $newnet->{$gw}; my $oldip = $optdata->{$ip}; + my $oldgw = $optdata->{$gw}; my $change_ip = &$safe_string_ne($oldip, $newip); my $change_gw = &$safe_string_ne($optdata->{$gw}, $newgw); @@ -836,6 +837,12 @@ sub update_ipconfig { # warn and continue warn $@ if $@; } + if ($oldgw) { + eval { &$ipcmd($family_opt, 'route', 'del', $oldgw, 'dev', $eth); }; + # if the route was not deleted, the guest might have deleted it manually + # warn and continue + warn $@ if $@; + } } # from this point on we save the configuration -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel