diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-16 13:36:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 13:36:47 +0200 |
commit | 96fb5dc94d88bc4eafe82382bfb26b64c479f76b (patch) | |
tree | 78a831b89f1a4581884a6d520fcd1c4799210d4e /pkg/network/netconflist.go | |
parent | f1f1834f91c84b68f5c95dea68c9ecbbf60eb696 (diff) | |
parent | 07e3f1bba9674c0cb93a0fa260930bfebbf75728 (diff) | |
download | podman-96fb5dc94d88bc4eafe82382bfb26b64c479f76b.tar.gz podman-96fb5dc94d88bc4eafe82382bfb26b64c479f76b.tar.bz2 podman-96fb5dc94d88bc4eafe82382bfb26b64c479f76b.zip |
Merge pull request #7314 from aojea/ipv6_default_gw
IPv6 default route
Diffstat (limited to 'pkg/network/netconflist.go')
-rw-r--r-- | pkg/network/netconflist.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pkg/network/netconflist.go b/pkg/network/netconflist.go index 4271d3f54..8187fdb39 100644 --- a/pkg/network/netconflist.go +++ b/pkg/network/netconflist.go @@ -6,6 +6,11 @@ import ( "path/filepath" ) +const ( + defaultIPv4Route = "0.0.0.0/0" + defaultIPv6Route = "::/0" +) + // NcList describes a generic map type NcList map[string]interface{} @@ -86,9 +91,13 @@ func NewIPAMRoute(r *net.IPNet) IPAMRoute { //nolint:interfacer } // NewIPAMDefaultRoute creates a new IPAMDefault route of -// 0.0.0.0/0 -func NewIPAMDefaultRoute() (IPAMRoute, error) { - _, n, err := net.ParseCIDR("0.0.0.0/0") +// 0.0.0.0/0 for IPv4 or ::/0 for IPv6 +func NewIPAMDefaultRoute(isIPv6 bool) (IPAMRoute, error) { + route := defaultIPv4Route + if isIPv6 { + route = defaultIPv6Route + } + _, n, err := net.ParseCIDR(route) if err != nil { return IPAMRoute{}, err } |