mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-16 16:34:09 +02:00
only use kernel modules error as context to an actual error, not as a requirement since some systems don't show what they support reliably
This commit is contained in:
@@ -12,12 +12,11 @@ import (
|
||||
var ErrConntrackNetlinkNotSupported = errors.New("nf_conntrack_netlink is not supported by the kernel")
|
||||
|
||||
func (n *NetLink) FlushConntrack() error {
|
||||
if !n.conntrackNetlink {
|
||||
return fmt.Errorf("%w", ErrConntrackNetlinkNotSupported)
|
||||
}
|
||||
|
||||
conn, err := netfilter.Dial(nil)
|
||||
if err != nil {
|
||||
if !n.conntrackNetlink {
|
||||
err = fmt.Errorf("%w: %w", err, ErrConntrackNetlinkNotSupported)
|
||||
}
|
||||
return fmt.Errorf("dialing netfilter: %w", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
@@ -36,6 +35,9 @@ func (n *NetLink) FlushConntrack() error {
|
||||
|
||||
_, err = conn.Query(request)
|
||||
if err != nil {
|
||||
if !n.conntrackNetlink {
|
||||
err = fmt.Errorf("%w: %w", err, ErrConntrackNetlinkNotSupported)
|
||||
}
|
||||
return fmt.Errorf("querying netlink request: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user