mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
wgengine/magicsock: actually use AF_PACKET socket for raw disco
Previously, despite what the commit said, we were using a raw IP socket that was *not* an AF_PACKET socket, and thus was subject to the host firewall rules. Switch to using a real AF_PACKET socket to actually get the functionality we want. Updates #13140 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: If657daeeda9ab8d967e75a4f049c66e2bca54b78
This commit is contained in:
@@ -393,6 +393,11 @@ func (q *Parsed) Buffer() []byte {
|
||||
// Payload returns the payload of the IP subprotocol section.
|
||||
// This is a read-only view; that is, q retains the ownership of the buffer.
|
||||
func (q *Parsed) Payload() []byte {
|
||||
// If the packet is truncated, return nothing instead of crashing.
|
||||
if q.length > len(q.b) || q.dataofs > len(q.b) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return q.b[q.dataofs:q.length]
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user