mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
fix(firewall): flush conntrack table after enabling firewall at container start
- prevent leaks for connections made the first ~10 milliseconds when Gluetun starts - seems critical, but in practice this very rarely happen and it very hard to reproduce
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ti-mo/conntrack"
|
||||
)
|
||||
|
||||
func (n *NetLink) FlushConntrack() error {
|
||||
conn, err := conntrack.Dial(nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("dialing conntrack: %w", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
return conn.Flush()
|
||||
}
|
||||
Reference in New Issue
Block a user