magicsock: set the don't fragment sockopt (#8715)
This sets the Don't Fragment flag, for now behind the TS_DEBUG_ENABLE_PMTUD envknob. Updates #311. Signed-off-by: Val <valerie@tailscale.com> Signed-off-by: salman <salman@tailscale.com>
This commit is contained in:
@@ -2233,6 +2233,16 @@ func (c *Conn) bindSocket(ruc *RebindingUDPConn, network string, curPortFate cur
|
||||
continue
|
||||
}
|
||||
trySetSocketBuffer(pconn, c.logf)
|
||||
|
||||
if CanPMTUD() {
|
||||
err = setDontFragment(pconn, network)
|
||||
if err != nil {
|
||||
c.logf("magicsock: set dontfragment failed for %v port %d: %v", network, port, err)
|
||||
// TODO disable PMTUD in this case. We don't expect the setsockopt to fail on
|
||||
// supported platforms, but we might as well be paranoid.
|
||||
}
|
||||
}
|
||||
|
||||
// Success.
|
||||
if debugBindSocket() {
|
||||
c.logf("magicsock: bindSocket: successfully listened %v port %d", network, port)
|
||||
|
||||
Reference in New Issue
Block a user