summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2020-11-26 18:05:00 +0100
committerAnders F Björklund <anders.f.bjorklund@gmail.com>2020-12-01 22:33:16 +0100
commitdb70e91bde90514ace510f66a1069207217a8d69 (patch)
tree80f85ad68fdbfbb75c662640ad430a299abd7c07 /libpod
parentde2b15f4d5a8cd3bf9006d0f3ecdfa75b316f495 (diff)
downloadpodman-db70e91bde90514ace510f66a1069207217a8d69.tar.gz
podman-db70e91bde90514ace510f66a1069207217a8d69.tar.bz2
podman-db70e91bde90514ace510f66a1069207217a8d69.zip
Validate that the bridge option is supported
Thanks Luap99 for the validation suggestion Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/network/create.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/libpod/network/create.go b/libpod/network/create.go
index e9ab93262..094fbe349 100644
--- a/libpod/network/create.go
+++ b/libpod/network/create.go
@@ -173,14 +173,26 @@ func createBridge(name string, options entities.NetworkCreateOptions, runtimeCon
ipMasq = false
}
- mtu, err := parseMTU(options.Options["mtu"])
- if err != nil {
- return "", err
- }
+ var mtu int
+ var vlan int
+ for k, v := range options.Options {
+ var err error
+ switch k {
+ case "mtu":
+ mtu, err = parseMTU(v)
+ if err != nil {
+ return "", err
+ }
- vlan, err := parseVlan(options.Options["vlan"])
- if err != nil {
- return "", err
+ case "vlan":
+ vlan, err = parseVlan(v)
+ if err != nil {
+ return "", err
+ }
+
+ default:
+ return "", errors.Errorf("unsupported option %s", k)
+ }
}
// obtain host bridge name