Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/netutil/netutil_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net"
"os/exec"
"path/filepath"
"strconv"
"strings"

"github.com/Masterminds/semver/v3"
Expand Down Expand Up @@ -94,13 +95,19 @@ func (e *CNIEnv) generateCNIPlugins(driver string, name string, ipam map[string]
switch driver {
case "bridge":
mtu := 0
iPMasq := true
for opt, v := range opts {
switch opt {
case "mtu", "com.docker.network.driver.mtu":
mtu, err = ParseMTU(v)
if err != nil {
return nil, err
}
case "ip-masq", "com.docker.network.bridge.enable_ip_masquerade":
iPMasq, err = strconv.ParseBool(v)
if err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("unsupported %q network option %q", driver, opt)
}
Expand All @@ -114,7 +121,7 @@ func (e *CNIEnv) generateCNIPlugins(driver string, name string, ipam map[string]
bridge.MTU = mtu
bridge.IPAM = ipam
bridge.IsGW = true
bridge.IPMasq = true
bridge.IPMasq = iPMasq
bridge.HairpinMode = true
plugins = []CNIPlugin{bridge, newPortMapPlugin(), newFirewallPlugin(), newTuningPlugin()}
plugins = fixUpIsolation(e, name, plugins)
Expand Down