mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 18:16:52 +01:00
RawConn builds IPv4 headers only, but WriteTo called As4() on every destination. Once a handshake passed tun.multiport.tx_handshake_delay, the handshake manager sent a multiport copy to every remote, and the first IPv6 address panicked with "As4 called on IPv6 address". The tunnel send path in inside.go had the same problem for any multiport tunnel with an IPv6 remote. Add udp.RawSupported and only use the raw socket for IPv4 (and IPv4-mapped) destinations; IPv6 remotes fall back to the normal UDP writer. RawConn.WriteTo now returns an error rather than panicking, matching ErrInvalidIPv6RemoteForSocket on the regular UDP sockets. Seen in production on v1.11.1-slack1: https://slack-pde.slack.com/archives/GK7NPNGPP/p1792590741819449 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
16 lines
406 B
Go
16 lines
406 B
Go
package udp
|
|
|
|
import (
|
|
"net/netip"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRawSupported(t *testing.T) {
|
|
assert.True(t, RawSupported(netip.MustParseAddrPort("1.2.3.4:4242")))
|
|
assert.True(t, RawSupported(netip.MustParseAddrPort("[::ffff:1.2.3.4]:4242")))
|
|
assert.False(t, RawSupported(netip.MustParseAddrPort("[2001:db8::1]:4242")))
|
|
assert.False(t, RawSupported(netip.AddrPort{}))
|
|
}
|