summaryrefslogtreecommitdiff
path: root/libpod/networking_unsupported.go
diff options
context:
space:
mode:
authorDoug Rabson <dfr@rabson.org>2022-08-12 10:51:48 +0100
committerDoug Rabson <dfr@rabson.org>2022-08-17 11:45:07 +0100
commit1b88927c2cf1db7b6530748d67528b5209d93b42 (patch)
tree1007201debe0b3697a12092cd2a15f4a64a748fa /libpod/networking_unsupported.go
parentc90eec2700d2e00a4b8f1e06ca640c034af5a530 (diff)
downloadpodman-1b88927c2cf1db7b6530748d67528b5209d93b42.tar.gz
podman-1b88927c2cf1db7b6530748d67528b5209d93b42.tar.bz2
podman-1b88927c2cf1db7b6530748d67528b5209d93b42.zip
libpod: Add stubs for non-linux builds
Note: this makes info.go linux-only since it mixes linux-specific and generic code. This should be addressed in a separate refactoring PR. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
Diffstat (limited to 'libpod/networking_unsupported.go')
-rw-r--r--libpod/networking_unsupported.go79
1 files changed, 79 insertions, 0 deletions
diff --git a/libpod/networking_unsupported.go b/libpod/networking_unsupported.go
new file mode 100644
index 000000000..227b512cd
--- /dev/null
+++ b/libpod/networking_unsupported.go
@@ -0,0 +1,79 @@
+//go:build !linux
+// +build !linux
+
+package libpod
+
+import (
+ "errors"
+ "path/filepath"
+
+ "github.com/containers/common/libnetwork/types"
+ "github.com/containers/podman/v4/libpod/define"
+ "github.com/containers/storage/pkg/lockfile"
+)
+
+type RootlessNetNS struct {
+ dir string
+ Lock lockfile.Locker
+}
+
+// ocicniPortsToNetTypesPorts convert the old port format to the new one
+// while deduplicating ports into ranges
+func ocicniPortsToNetTypesPorts(ports []types.OCICNIPortMapping) []types.PortMapping {
+ return []types.PortMapping{}
+}
+
+func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {
+ return nil, errors.New("not implemented (*Container) getContainerNetworkInfo")
+}
+
+func (c *Container) setupRootlessNetwork() error {
+ return errors.New("not implemented (*Container) setupRootlessNetwork")
+}
+
+func (r *Runtime) setupNetNS(ctr *Container) error {
+ return errors.New("not implemented (*Runtime) setupNetNS")
+}
+
+// normalizeNetworkName takes a network name, a partial or a full network ID and returns the network name.
+// If the network is not found a errors is returned.
+func (r *Runtime) normalizeNetworkName(nameOrID string) (string, error) {
+ return "", errors.New("not implemented (*Runtime) normalizeNetworkName")
+}
+
+// DisconnectContainerFromNetwork removes a container from its CNI network
+func (r *Runtime) DisconnectContainerFromNetwork(nameOrID, netName string, force bool) error {
+ return errors.New("not implemented (*Runtime) DisconnectContainerFromNetwork")
+}
+
+// ConnectContainerToNetwork connects a container to a CNI network
+func (r *Runtime) ConnectContainerToNetwork(nameOrID, netName string, netOpts types.PerNetworkOptions) error {
+ return errors.New("not implemented (*Runtime) ConnectContainerToNetwork")
+}
+
+// getPath will join the given path to the rootless netns dir
+func (r *RootlessNetNS) getPath(path string) string {
+ return filepath.Join(r.dir, path)
+}
+
+// Do - run the given function in the rootless netns.
+// It does not lock the rootlessCNI lock, the caller
+// should only lock when needed, e.g. for cni operations.
+func (r *RootlessNetNS) Do(toRun func() error) error {
+ return errors.New("not implemented (*RootlessNetNS) Do")
+}
+
+// Cleanup the rootless network namespace if needed.
+// It checks if we have running containers with the bridge network mode.
+// Cleanup() expects that r.Lock is locked
+func (r *RootlessNetNS) Cleanup(runtime *Runtime) error {
+ return errors.New("not implemented (*RootlessNetNS) Cleanup")
+}
+
+// GetRootlessNetNs returns the rootless netns object. If create is set to true
+// the rootless network namespace will be created if it does not exists already.
+// If called as root it returns always nil.
+// On success the returned RootlessCNI lock is locked and must be unlocked by the caller.
+func (r *Runtime) GetRootlessNetNs(new bool) (*RootlessNetNS, error) {
+ return nil, errors.New("not implemented (*Runtime) GetRootlessNetNs")
+}