diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-07-21 13:57:11 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-07-21 15:36:33 +0200 |
commit | 56093a3b4653ce8c93ccaca34f26f9c741658ea3 (patch) | |
tree | 4f7b3816e33461722a9e46ccb5fc4e00bfff3181 | |
parent | 80ad0cfd05f970fea46545dc51cad35d14542a59 (diff) | |
download | podman-56093a3b4653ce8c93ccaca34f26f9c741658ea3.tar.gz podman-56093a3b4653ce8c93ccaca34f26f9c741658ea3.tar.bz2 podman-56093a3b4653ce8c93ccaca34f26f9c741658ea3.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>
-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 } |