summaryrefslogtreecommitdiff
path: root/cmd/podman/network_create.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-11-14 12:48:45 -0600
committerbaude <bbaude@redhat.com>2019-12-09 08:40:40 -0600
commitef872dcd21c60af70ab1848a7e0c873f142f6f44 (patch)
treeb1d98078a7c620cec454708ff85ca0df70a32b19 /cmd/podman/network_create.go
parent225f22b9d5dfd0d1582a56530142fe8ffb960a91 (diff)
downloadpodman-ef872dcd21c60af70ab1848a7e0c873f142f6f44.tar.gz
podman-ef872dcd21c60af70ab1848a7e0c873f142f6f44.tar.bz2
podman-ef872dcd21c60af70ab1848a7e0c873f142f6f44.zip
macvlan networks
add the ability to a macvlan network with podman network create. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/network_create.go')
-rw-r--r--cmd/podman/network_create.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/podman/network_create.go b/cmd/podman/network_create.go
index 6710883ae..886607885 100644
--- a/cmd/podman/network_create.go
+++ b/cmd/podman/network_create.go
@@ -41,6 +41,7 @@ func init() {
flags.IPVar(&networkCreateCommand.Gateway, "gateway", nil, "IPv4 or IPv6 gateway for the subnet")
flags.BoolVar(&networkCreateCommand.Internal, "internal", false, "restrict external access from this network")
flags.IPNetVar(&networkCreateCommand.IPRange, "ip-range", net.IPNet{}, "allocate container IP from range")
+ flags.StringVar(&networkCreateCommand.MacVLAN, "macvlan", "", "create a Macvlan connection based on this device")
// TODO not supported yet
//flags.StringVar(&networkCreateCommand.IPamDriver, "ipam-driver", "", "IP Address Management Driver")
// TODO enable when IPv6 is working
@@ -50,6 +51,10 @@ func init() {
}
func networkcreateCmd(c *cliconfig.NetworkCreateValues) error {
+ var (
+ fileName string
+ err error
+ )
if err := network.IsSupportedDriver(c.Driver); err != nil {
return err
}
@@ -66,7 +71,11 @@ func networkcreateCmd(c *cliconfig.NetworkCreateValues) error {
if err != nil {
return err
}
- fileName, err := runtime.NetworkCreate(c)
+ if len(c.MacVLAN) > 0 {
+ fileName, err = runtime.NetworkCreateMacVLAN(c)
+ } else {
+ fileName, err = runtime.NetworkCreateBridge(c)
+ }
if err == nil {
fmt.Println(fileName)
}