summaryrefslogtreecommitdiff
path: root/pkg/network/network.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-12-14 17:06:50 +0100
committerPaul Holzinger <pholzing@redhat.com>2021-12-14 18:41:06 +0100
commit888c778ee975b449aef6dec6bbdfb029a7fe385e (patch)
treed53a9077a78838a28ae33a615e317d913b3c01b4 /pkg/network/network.go
parentc501c1d6423759d9180bfe254d1bbe7662d89868 (diff)
downloadpodman-888c778ee975b449aef6dec6bbdfb029a7fe385e.tar.gz
podman-888c778ee975b449aef6dec6bbdfb029a7fe385e.tar.bz2
podman-888c778ee975b449aef6dec6bbdfb029a7fe385e.zip
fix network id handling
We have to get the network ID from the network backend. With the netavark backend we no longer use the sha from the name as ID. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/network/network.go')
-rw-r--r--pkg/network/network.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/pkg/network/network.go b/pkg/network/network.go
deleted file mode 100644
index 44132ca28..000000000
--- a/pkg/network/network.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package network
-
-import (
- "crypto/sha256"
- "encoding/hex"
- "strings"
-
- "github.com/containernetworking/cni/libcni"
-)
-
-// GetCNIPlugins returns a list of plugins that a given network
-// has in the form of a string
-func GetCNIPlugins(list *libcni.NetworkConfigList) string {
- plugins := make([]string, 0, len(list.Plugins))
- for _, plug := range list.Plugins {
- plugins = append(plugins, plug.Network.Type)
- }
- return strings.Join(plugins, ",")
-}
-
-// GetNetworkID return the network ID for a given name.
-// It is just the sha256 hash but this should be good enough.
-// The caller has to make sure it is only called with the network name.
-func GetNetworkID(name string) string {
- hash := sha256.Sum256([]byte(name))
- return hex.EncodeToString(hash[:])
-}