From 706a482340141f8edb26fefae993e96b1581b034 Mon Sep 17 00:00:00 2001 From: Nuno Diegues Date: Sun, 19 Jun 2022 18:38:34 +0100 Subject: [PATCH] only set DF for sockets that can handle it (#3448) Fixes #3445 --- sys_conn.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys_conn.go b/sys_conn.go index d73b01d2341..7cc05465808 100644 --- a/sys_conn.go +++ b/sys_conn.go @@ -30,9 +30,13 @@ func wrapConn(pc net.PacketConn) (rawConn, error) { if err != nil { return nil, err } - err = setDF(rawConn) - if err != nil { - return nil, err + + if _, ok := pc.LocalAddr().(*net.UDPAddr); ok { + // Only set DF on sockets that we expect to be able to handle that configuration. + err = setDF(rawConn) + if err != nil { + return nil, err + } } } c, ok := pc.(OOBCapablePacketConn)