mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-10 14:22:30 +02:00
hotfix(firewall/iptables): only restore firewall if IPv6 port redirection failed but NAT is supported
This commit is contained in:
@@ -278,7 +278,6 @@ func (c *Config) RedirectPort(ctx context.Context, intf string,
|
|||||||
appendOrDelete(remove), interfaceFlag, destinationPort),
|
appendOrDelete(remove), interfaceFlag, destinationPort),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
restore(ctx) // just in case
|
|
||||||
errMessage := err.Error()
|
errMessage := err.Error()
|
||||||
if strings.Contains(errMessage, "can't initialize ip6tables table `nat': Table does not exist") {
|
if strings.Contains(errMessage, "can't initialize ip6tables table `nat': Table does not exist") {
|
||||||
if !remove {
|
if !remove {
|
||||||
@@ -286,6 +285,7 @@ func (c *Config) RedirectPort(ctx context.Context, intf string,
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
restore(ctx)
|
||||||
return fmt.Errorf("redirecting IPv6 source port %d to destination port %d on interface %s: %w",
|
return fmt.Errorf("redirecting IPv6 source port %d to destination port %d on interface %s: %w",
|
||||||
sourcePort, destinationPort, intf, err)
|
sourcePort, destinationPort, intf, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user