Skip to content

Commit 2cc6279

Browse files
committed
Add internal n/w bridge to firewalld docker zone
Containers attached to an 'internal' bridge network are unable to communicate when the host is running firewalld. Non-internal bridges are added to a trusted 'docker' firewalld zone, but internal bridges were not. DOCKER-ISOLATION iptables rules are still configured for an internal network, they block traffic to/from addresses outside the network's subnet. Signed-off-by: Rob Murray <[email protected]>
1 parent f472dda commit 2cc6279

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

libnetwork/drivers/bridge/setup_ip_tables_linux.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99

1010
"github.com/containerd/log"
11+
"github.com/docker/docker/errdefs"
1112
"github.com/docker/docker/libnetwork/iptables"
1213
"github.com/docker/docker/libnetwork/types"
1314
"github.com/vishvananda/netlink"
@@ -408,6 +409,17 @@ func setupInternalNetworkRules(bridgeIface string, addr *net.IPNet, icc, insert
408409
var version iptables.IPVersion
409410
var inDropRule, outDropRule iptRule
410411

412+
// Either add or remove the interface from the firewalld zone, if firewalld is running.
413+
if insert {
414+
if err := iptables.AddInterfaceFirewalld(bridgeIface); err != nil {
415+
return err
416+
}
417+
} else {
418+
if err := iptables.DelInterfaceFirewalld(bridgeIface); err != nil && !errdefs.IsNotFound(err) {
419+
return err
420+
}
421+
}
422+
411423
if addr.IP.To4() != nil {
412424
version = iptables.IPv4
413425
inDropRule = iptRule{

0 commit comments

Comments
 (0)