Skip to content

Commit 67e5a4e

Browse files
committed
Experimental! Reload nftables on SIGHUP
Signed-off-by: Rob Murray <[email protected]>
1 parent 5919a01 commit 67e5a4e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

libnetwork/drivers/bridge/internal/nftabler/nftabler.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ package nftabler
55
import (
66
"context"
77
"fmt"
8+
"os"
9+
"os/signal"
810

911
"github.com/docker/docker/libnetwork/drivers/bridge/internal/firewaller"
1012
"github.com/docker/docker/libnetwork/internal/nftables"
1113
"go.opentelemetry.io/otel"
14+
"golang.org/x/sys/unix"
1215
)
1316

1417
// Prefix for OTEL span names.
@@ -81,6 +84,20 @@ func NewNftabler(ctx context.Context, config firewaller.Config) (firewaller.Fire
8184
}
8285
}
8386

87+
// FIXME(robmry) - locking!
88+
c := make(chan os.Signal, 1)
89+
signal.Notify(c, unix.SIGHUP)
90+
go func() {
91+
for range c {
92+
if nft.config.IPv4 {
93+
nft.table4.Reload(ctx)
94+
}
95+
if nft.config.IPv6 {
96+
nft.table6.Reload(ctx)
97+
}
98+
}
99+
}()
100+
84101
return nft, nil
85102
}
86103

0 commit comments

Comments
 (0)