mirror of
https://github.com/tladesignz/dnstt.git
synced 2026-10-04 12:58:09 +03:00
Truncation and TC bit in responses.
This commit is contained in:
@@ -472,6 +472,12 @@ func sendLoop(dnsConn net.PacketConn, ttConn *turbotunnel.QueuePacketConn, ch <-
|
||||
log.Printf("resp WireFormat: %v", err)
|
||||
continue
|
||||
}
|
||||
// Truncate if necessary.
|
||||
// https://tools.ietf.org/html/rfc1035#section-4.1.1
|
||||
if len(buf) > maxUDPPayload {
|
||||
buf = buf[:maxUDPPayload]
|
||||
buf[2] |= 0x02 // TC = 1
|
||||
}
|
||||
_, err = dnsConn.WriteTo(buf, rec.Addr)
|
||||
if err != nil {
|
||||
if err, ok := err.(net.Error); ok && err.Temporary() {
|
||||
|
||||
Reference in New Issue
Block a user