From 04ec1d1bf9fa7b8ca46bc48fb0ff50b4ef98b901 Mon Sep 17 00:00:00 2001 From: henderiw Date: Thu, 3 Sep 2020 12:04:13 +0200 Subject: [PATCH] fix-netlink --- .gitignore | 5 +---- clab/netlink.go | 13 +++++++------ main.go | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 847dfa533..7504319f7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,8 +27,5 @@ graph/* containerlab* containerlab*/ license.key -<<<<<<< Updated upstream lab-wan -lab-wan/* -======= ->>>>>>> Stashed changes +lab-wan/* \ No newline at end of file diff --git a/clab/netlink.go b/clab/netlink.go index 7afc9963b..d9ae092c0 100644 --- a/clab/netlink.go +++ b/clab/netlink.go @@ -86,18 +86,19 @@ func (c *cLab) CreateVirtualWiring(id int, link *Link) (err error) { } log.Debug("set RX, TX offload off on container A") - cmd = exec.Command("sudo", "docker", "exec", "-ti", link.a.Node.LongName, "ethtool", "--offload", link.a.EndpointName, "rx", "off", "tx", "off") - _, err = cmd.CombinedOutput() + var b []byte + b, err = exec.Command("docker", "exec", link.a.Node.LongName, "ethtool", "--offload", link.a.EndpointName, "rx", "off", "tx", "off").CombinedOutput() if err != nil { - log.Debug("cmd.Run() failed with", err) + log.Debugf("cmd.Run() failed with: %s", err) } + log.Debugf("%s", string(b)) log.Debug("set RX, TX offload off on container B") - cmd = exec.Command("sudo", "docker", "exec", "-ti", link.b.Node.LongName, "ethtool", "--offload", link.b.EndpointName, "rx", "off", "tx", "off") - _, err = cmd.CombinedOutput() + b, err = exec.Command("docker", "exec", link.b.Node.LongName, "ethtool", "--offload", link.b.EndpointName, "rx", "off", "tx", "off").CombinedOutput() if err != nil { - log.Debug("cmd.Run() failed with", err) + log.Debugf("cmd.Run() failed with: %s", err) } + log.Debugf("%s", string(b)) //ip link add tmp_a type veth peer name tmp_b //ip link set tmp_a netns $srl_a diff --git a/main.go b/main.go index 3e8acd817..5d7466c2c 100644 --- a/main.go +++ b/main.go @@ -79,7 +79,7 @@ func main() { log.Error(err) } - log.Info("Create contaianer:", shortDutName) + log.Info("Create container:", shortDutName) if err = c.CreateContainer(ctx, shortDutName, node); err != nil { log.Error(err) }