Skip to content

Commit e3d20e6

Browse files
committed
fix(egress): make SO_MARK best-effort for non-privileged environments
SO_MARK requires CAP_NET_ADMIN which is unavailable in CI runners and development environments. The mark is only needed when iptables transparent redirect is active (container runtime), so silently ignore the error elsewhere.
1 parent 6c8a2e0 commit e3d20e6

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

components/egress/pkg/credentialvault/source_http_transport_linux.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ import (
2828
func httpSourceTransport() http.RoundTripper {
2929
dialer := defaultTransportDialer()
3030
dialer.Control = func(network, address string, c syscall.RawConn) error {
31-
var opErr error
32-
if err := c.Control(func(fd uintptr) {
33-
opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_MARK, constants.MarkValue)
34-
}); err != nil {
35-
return err
36-
}
37-
return opErr
31+
_ = c.Control(func(fd uintptr) {
32+
// Best-effort: requires CAP_NET_ADMIN. In environments without
33+
// iptables transparent redirect (tests, dev), the mark is
34+
// unnecessary and the error is harmless.
35+
_ = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_MARK, constants.MarkValue)
36+
})
37+
return nil
3838
}
3939
return &http.Transport{DialContext: dialer.DialContext}
4040
}

0 commit comments

Comments
 (0)