Skip to content

Commit

Permalink
Merge pull request #47303 from akerouanton/25.0-backport-internal-bri…
Browse files Browse the repository at this point in the history
…dge-firewalld

[25.0 backport] Add internal n/w bridge to firewalld docker zone
  • Loading branch information
thaJeztah committed Feb 2, 2024
2 parents a140d0d + 990e95d commit 282891f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libnetwork/drivers/bridge/setup_ip_tables_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/containerd/log"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libnetwork/iptables"
"github.com/docker/docker/libnetwork/types"
"github.com/vishvananda/netlink"
Expand Down Expand Up @@ -408,6 +409,17 @@ func setupInternalNetworkRules(bridgeIface string, addr *net.IPNet, icc, insert
var version iptables.IPVersion
var inDropRule, outDropRule iptRule

// Either add or remove the interface from the firewalld zone, if firewalld is running.
if insert {
if err := iptables.AddInterfaceFirewalld(bridgeIface); err != nil {
return err
}
} else {
if err := iptables.DelInterfaceFirewalld(bridgeIface); err != nil && !errdefs.IsNotFound(err) {
return err
}
}

if addr.IP.To4() != nil {
version = iptables.IPv4
inDropRule = iptRule{
Expand Down

0 comments on commit 282891f

Please sign in to comment.