summaryrefslogtreecommitdiff
path: root/libpod/network/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/network/create.go')
-rw-r--r--libpod/network/create.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/libpod/network/create.go b/libpod/network/create.go
index 88310a79c..deacf487a 100644
--- a/libpod/network/create.go
+++ b/libpod/network/create.go
@@ -249,6 +249,7 @@ func createBridge(name string, options entities.NetworkCreateOptions, runtimeCon
func createMacVLAN(name string, options entities.NetworkCreateOptions, runtimeConfig *config.Config) (string, error) {
var (
+ mtu int
plugins []CNIPlugins
)
liveNetNames, err := GetLiveNetworkNames()
@@ -283,7 +284,19 @@ func createMacVLAN(name string, options entities.NetworkCreateOptions, runtimeCo
}
}
ncList := NewNcList(name, version.Current(), options.Labels)
- macvlan := NewMacVLANPlugin(parentNetworkDevice)
+ if val, ok := options.Options["mtu"]; ok {
+ intVal, err := strconv.Atoi(val)
+ if err != nil {
+ return "", err
+ }
+ if intVal > 0 {
+ mtu = intVal
+ }
+ }
+ macvlan, err := NewMacVLANPlugin(parentNetworkDevice, options.Gateway, &options.Range, &options.Subnet, mtu)
+ if err != nil {
+ return "", err
+ }
plugins = append(plugins, macvlan)
ncList["plugins"] = plugins
b, err := json.MarshalIndent(ncList, "", " ")