bridge: Reapply endpoint iptables rules on firewalld reload

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
(cherry picked from commit 07393071ad)
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Andrey Epifanov
2025-06-23 03:42:46 -07:00
committed by Rob Murray
parent 29ed80aa86
commit 3e9ff78b94

View File

@@ -792,11 +792,20 @@ func releasePortBindings(pbs []portBinding, fwn firewaller.Network) error {
func (n *bridgeNetwork) reapplyPerPortIptables() {
n.Lock()
var allPBs []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)
}