From ee432cf2792c5dbe81953007f1fd5c87beb3ebd5 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 8 Aug 2019 06:01:00 -0500 Subject: podman network create initial implementation of network create. we only support bridging networks with this first pass. Signed-off-by: baude --- pkg/network/ip.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pkg/network/ip.go (limited to 'pkg/network/ip.go') diff --git a/pkg/network/ip.go b/pkg/network/ip.go new file mode 100644 index 000000000..1798cd939 --- /dev/null +++ b/pkg/network/ip.go @@ -0,0 +1,14 @@ +package network + +import ( + "net" + + "github.com/containernetworking/plugins/pkg/ip" +) + +// CalcGatewayIP takes a network and returns the first IP in it. +func CalcGatewayIP(ipn *net.IPNet) net.IP { + // taken from cni bridge plugin as it is not exported + nid := ipn.IP.Mask(ipn.Mask) + return ip.NextIP(nid) +} -- cgit v1.2.3-54-g00ecf