diff options
author | Michael Brown | 2011-09-19 16:48:57 +0200 |
---|---|---|
committer | Michael Brown | 2011-09-19 16:52:54 +0200 |
commit | 469bd11f392797027b68e9d22f8f59a547886515 (patch) | |
tree | 9a8de4cf54eae0e2cc1d85d4561a6c9121e004e8 /src/net/tcp.c | |
parent | [tls] Accept certificates without a version number (diff) | |
download | ipxe-469bd11f392797027b68e9d22f8f59a547886515.tar.gz ipxe-469bd11f392797027b68e9d22f8f59a547886515.tar.xz ipxe-469bd11f392797027b68e9d22f8f59a547886515.zip |
[tcp] Allow sufficient headroom for TCP headers
TCP currently neglects to allow sufficient space for its own headers
when allocating I/O buffers. This problem is masked by the fact that
the maximum link-layer header size (802.11) is substantially larger
than the common Ethernet link-layer header.
Fix by allowing sufficient space for any TCP headers, as well as the
network-layer and link-layer headers.
Reported-by: Scott K Logan <logans@cottsay.net>
Debugged-by: Scott K Logan <logans@cottsay.net>
Tested-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r-- | src/net/tcp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c index 4df1aed5..0a7924a7 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -509,14 +509,14 @@ static int tcp_xmit ( struct tcp_connection *tcp ) { start_timer ( &tcp->timer ); /* Allocate I/O buffer */ - iobuf = alloc_iob ( len + MAX_LL_NET_HEADER_LEN ); + iobuf = alloc_iob ( len + TCP_MAX_HEADER_LEN ); if ( ! iobuf ) { DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x " "%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ), tcp->rcv_ack ); return -ENOMEM; } - iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN ); + iob_reserve ( iobuf, TCP_MAX_HEADER_LEN ); /* Fill data payload from transmit queue */ tcp_process_tx_queue ( tcp, len, iobuf, 0 ); @@ -653,14 +653,14 @@ static int tcp_xmit_reset ( struct tcp_connection *tcp, int rc; /* Allocate space for dataless TX buffer */ - iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN ); + iobuf = alloc_iob ( TCP_MAX_HEADER_LEN ); if ( ! iobuf ) { DBGC ( tcp, "TCP %p could not allocate iobuf for RST " "%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) ); return -ENOMEM; } - iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN ); + iob_reserve ( iobuf, TCP_MAX_HEADER_LEN ); /* Construct RST response */ tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) ); |