diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-02 09:49:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-02 09:49:18 -0400 |
commit | a8b8ccdc166519270044a7bd1f9d04018eb5044b (patch) | |
tree | 6d1921211bd38c278a438ee9ec3892825c000762 /libpod/network/devices.go | |
parent | 4207d959a68c1ee2b805b7113838580c14f4bbc6 (diff) | |
parent | ddeaaa47c89a00104c457554e0542d988f75e612 (diff) | |
download | podman-a8b8ccdc166519270044a7bd1f9d04018eb5044b.tar.gz podman-a8b8ccdc166519270044a7bd1f9d04018eb5044b.tar.bz2 podman-a8b8ccdc166519270044a7bd1f9d04018eb5044b.zip |
Merge pull request #11404 from Luap99/ip-del
Drop dependency on iproute
Diffstat (limited to 'libpod/network/devices.go')
-rw-r--r-- | libpod/network/devices.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libpod/network/devices.go b/libpod/network/devices.go index de6bb4efc..fc9aff337 100644 --- a/libpod/network/devices.go +++ b/libpod/network/devices.go @@ -2,12 +2,11 @@ package network import ( "fmt" - "os/exec" "github.com/containers/common/pkg/config" "github.com/containers/podman/v3/pkg/util" - "github.com/containers/podman/v3/utils" "github.com/sirupsen/logrus" + "github.com/vishvananda/netlink" ) // GetFreeDeviceName returns a device name that is unused; used when no network @@ -52,12 +51,9 @@ func GetFreeDeviceName(config *config.Config) (string, error) { // RemoveInterface removes an interface by the given name func RemoveInterface(interfaceName string) error { - // Make sure we have the ip command on the system - ipPath, err := exec.LookPath("ip") + link, err := netlink.LinkByName(interfaceName) if err != nil { return err } - // Delete the network interface - _, err = utils.ExecCmd(ipPath, []string{"link", "del", interfaceName}...) - return err + return netlink.LinkDel(link) } |