[lacp] Ignore (and do not echo) trailing padding on received packets

The LACP responder reuses the received I/O buffer to construct the
response LACP (or marker) packet.  Any received padding will therefore
be unintentionally included within the response.

Truncate the received I/O buffer to the expected length (which is
already defined in a way to allow for future protocol expansion)
before reusing it to construct the response.

Reported-by: Tore Anderson <tore@fud.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/158/head
Michael Brown 2020-10-14 14:05:03 +01:00
parent 3d43789914
commit 388d657080
1 changed files with 3 additions and 0 deletions

View File

@ -286,6 +286,9 @@ static int eth_slow_rx ( struct io_buffer *iobuf,
return -EINVAL;
}
/* Strip any trailing padding */
iob_unput ( iobuf, ( sizeof ( *eth_slow ) - iob_len ( iobuf ) ) );
/* Handle according to subtype */
switch ( eth_slow->header.subtype ) {
case ETH_SLOW_SUBTYPE_LACP: