From 01a3ea887182733f2ad85f9f77a4dd41985a6721 Mon Sep 17 00:00:00 2001 From: Daniel Ding Date: Fri, 18 Apr 2025 15:10:39 +0800 Subject: [PATCH] fix: noudpsum for vxlan. --- pkg/libol/iputils.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pkg/libol/iputils.go b/pkg/libol/iputils.go index 20d48f1..3c430e6 100755 --- a/pkg/libol/iputils.go +++ b/pkg/libol/iputils.go @@ -7,6 +7,42 @@ import ( "strings" ) +func IpLinkAdd(name string, opts ...string) ([]byte, error) { + switch runtime.GOOS { + case "linux": + args := append([]string{ + "link", "add", name, + }, opts...) + return exec.Command("ip", args...).CombinedOutput() + default: + return nil, NewErr("IpLinkAdd %s notSupport", runtime.GOOS) + } +} + +func IpLinkSet(name string, opts ...string) ([]byte, error) { + switch runtime.GOOS { + case "linux": + args := append([]string{ + "link", "set", name, + }, opts...) + return exec.Command("ip", args...).CombinedOutput() + default: + return nil, NewErr("IpLinkSet %s notSupport", runtime.GOOS) + } +} + +func IpLinkDel(name string, opts ...string) ([]byte, error) { + switch runtime.GOOS { + case "linux": + args := append([]string{ + "link", "del", name, + }, opts...) + return exec.Command("ip", args...).CombinedOutput() + default: + return nil, NewErr("IpLinkDel %s notSupport", runtime.GOOS) + } +} + func IpLinkUp(name string) ([]byte, error) { switch runtime.GOOS { case "linux":