Skip to content

Commit

Permalink
Merge pull request #4655 from AkihiroSuda/fix-rootless-firewalld
Browse files Browse the repository at this point in the history
CNI bridge firewall: avoid using `iptables` backend on rootless mode
  • Loading branch information
tonistiigi authored Feb 20, 2024
2 parents 61d520e + d324113 commit 0174381
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion util/network/cniprovider/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ func NewBridge(opt Opt) (network.Provider, error) {
cniOptions = append(cniOptions, cni.WithPluginDir([]string{opt.BinaryDir}))
}

var firewallBackend string // empty value defaults to firewalld or iptables
if os.Getenv("ROOTLESSKIT_STATE_DIR") != "" {
// firewalld backend is incompatible with Rootless
// https://github.com/containerd/nerdctl/issues/2818
firewallBackend = "iptables"
}

cniOptions = append(cniOptions, cni.WithConfListBytes([]byte(fmt.Sprintf(`{
"cniVersion": "1.0.0",
"name": "buildkit",
Expand All @@ -103,10 +110,11 @@ func NewBridge(opt Opt) (network.Provider, error) {
},
{
"type": "%s",
"backend": "%s",
"ingressPolicy": "same-bridge"
}
]
}`, loopbackBinName, bridgeBinName, opt.BridgeName, hostLocalBinName, opt.BridgeSubnet, firewallBinName))))
}`, loopbackBinName, bridgeBinName, opt.BridgeName, hostLocalBinName, opt.BridgeSubnet, firewallBinName, firewallBackend))))

unlock, err := initLock()
if err != nil {
Expand Down

0 comments on commit 0174381

Please sign in to comment.