bridge: Reapply endpoint iptables rules on firewalld reload

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
This commit is contained in:
Andrey Epifanov
2025-06-23 03:42:46 -07:00
committed by Cory Snider
parent 6d457d9695
commit 07393071ad

View File

@@ -354,11 +354,20 @@ func (n *bridgeNetwork) unmapPBs(ctx context.Context, bindings []portmapperapi.P
func (n *bridgeNetwork) reapplyPerPortIptables() {
n.Lock()
var allPBs []portmapperapi.PortBinding
var allEPs []*bridgeEndpoint
for _, ep := range n.endpoints {
allPBs = append(allPBs, ep.portMapping...)
allEPs = append(allEPs, ep)
}
n.Unlock()
for _, ep := range allEPs {
netip4, netip6 := ep.netipAddrs()
if err := n.firewallerNetwork.AddEndpoint(context.TODO(), netip4, netip6); err != nil {
log.G(context.TODO()).Warnf("Failed to reconfigure Endpoint: %s", err)
}
}
if err := n.firewallerNetwork.AddPorts(context.Background(), mergeChildHostIPs(allPBs)); err != nil {
log.G(context.TODO()).Warnf("Failed to reconfigure NAT: %s", err)
}