diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-07-21 13:57:11 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2022-07-26 14:36:20 -0400 |
commit | 553a700966b6f5ae6dc092a7ad4eece9e2c4b32b (patch) | |
tree | 76174840455169c5ed049afa6b8a33d30bcf823b /pkg/api/handlers/compat | |
parent | aef8039d3755e1aa44b2b28c9ca8c4cc52d65251 (diff) | |
download | podman-553a700966b6f5ae6dc092a7ad4eece9e2c4b32b.tar.gz podman-553a700966b6f5ae6dc092a7ad4eece9e2c4b32b.tar.bz2 podman-553a700966b6f5ae6dc092a7ad4eece9e2c4b32b.zip |
compat api: always turn on network isolation for networks
Fix some network option parsing logic to use constants.
Always use the isolate option since this is what docker does.
Remove the icc option, this is different from isolate and it is not
implemented.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index bb1fa9ac3..29d1398cf 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -193,27 +193,22 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { network.Options = make(map[string]string) - // TODO: we should consider making this constants in c/common/libnetwork/types + // dockers bridge networks are always isolated from each other + if network.Driver == nettypes.BridgeNetworkDriver { + network.Options[nettypes.IsolateOption] = "true" + } + for opt, optVal := range networkCreate.Options { switch opt { - case "mtu": + case nettypes.MTUOption: fallthrough case "com.docker.network.driver.mtu": - if network.Driver == nettypes.BridgeNetworkDriver { - network.Options["mtu"] = optVal - } - case "icc": - fallthrough - case "com.docker.network.bridge.enable_icc": - // TODO: needs to be implemented - if network.Driver == nettypes.BridgeNetworkDriver { - responseWarning = "com.docker.network.bridge.enable_icc is not currently implemented" - } + network.Options[nettypes.MTUOption] = optVal case "com.docker.network.bridge.name": if network.Driver == nettypes.BridgeNetworkDriver { network.NetworkInterface = optVal } - case "mode": + case nettypes.ModeOption: if network.Driver == nettypes.MacVLANNetworkDriver || network.Driver == nettypes.IPVLANNetworkDriver { network.Options[opt] = optVal } |