rust-osdev/uefi-rs

`SimpleNetwork`s `transmit` passes too long buffer to SNP protocol.

Closed this issue · 1 comments

In proto/network/snp.rs the transmit method passes the sum of the provided buffer length (buffer.len()) plus the specified header_size as BufferSize to the protocol. In my small test program I can send valid packets (e.g. ARP) but on the wire I can also see additional (random) bytes being transmitted after my buffer.

With my reading of the spec then Buffer passed to transmit should already contain bytes for both header and body, and header_size only indicates whether the protocol should manipulate the header before sending. With that I think the right value to pass on as BufferSize would actually be just buffer.len().

However, the spec is inconsistent as it talks about "placeing the packet specified by Header and Buffer on the transmit queue" but I don't see any other mention of Header anywhere (certainly it's not a paramter for transmit).

I think you're correct, we should not be adding the header_size there. Thanks for reporting this, I'll put up a PR shortly.