mirror of
https://github.com/go-gost/x.git
synced 2026-10-20 08:18:33 +00:00
A frame that is not a parseable IPv4 or IPv6 packet is exactly what the kernel refuses. Measured on a real up tun device: the version nibble is the only thing it inspects, and anything but 4 or 6 comes back EINVAL at any length -- 1421, 1500 and 2000-byte frames with a valid header all go through untouched. That error left fromSpoke, unwound Handle, and took a 54-minute peer stream down with it. The spoke has always refused these frames before its device write, which is why a phone logs "unknown packet, discarded" all day and never dies while the hub had no equivalent. destinationOf returning !ok is exactly the kernel's reject condition, so that branch now drops and counts the frame instead of handing it to the device. This stops the malformed frame from killing the service; it does not fix what put one on the wire. The candidate cause is concurrent serveEdge writers racing on one local conn with no send lock on streamConn.Write, which is still unproven. Silently accepted sub-MTU spliced frames also remain -- the kernel does not validate TotalLen either.