]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[lacp] Ignore (and do not echo) trailing padding on received packets 158/head
authorMichael Brown <mcb30@ipxe.org>
Wed, 14 Oct 2020 13:05:03 +0000 (14:05 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 14 Oct 2020 13:18:49 +0000 (14:18 +0100)
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>
src/net/eth_slow.c

index fa7a6e361100c12d7254eff7ba4d07a8ca951904..1103a49f303af3b216f960f5cdd5e9e439635b40 100644 (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: