From 57ab6ab58ff0ff3928ef5a96928a800ac9706605 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 30 Jun 2022 17:27:38 +0800 Subject: [PATCH] Chore: cleanup bind mark code --- component/dialer/mark_linux.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/component/dialer/mark_linux.go b/component/dialer/mark_linux.go index e54873bc..759097df 100644 --- a/component/dialer/mark_linux.go +++ b/component/dialer/mark_linux.go @@ -31,13 +31,13 @@ func bindMarkToControl(mark int, chain controlFn) controlFn { } } - return c.Control(func(fd uintptr) { - switch network { - case "tcp4", "udp4": - syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, mark) - case "tcp6", "udp6": - syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, mark) - } + var innerErr error + err = c.Control(func(fd uintptr) { + innerErr = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, mark) }) + if innerErr != nil { + err = innerErr + } + return } }