mirror of https://github.com/ipxe/ipxe.git
[tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
878a1f4e2f
commit
d012f87018
|
@ -258,7 +258,6 @@ struct tcp_options {
|
||||||
#define TCP_MIN_PORT 1
|
#define TCP_MIN_PORT 1
|
||||||
|
|
||||||
/* Some IOB constants */
|
/* Some IOB constants */
|
||||||
#define MAX_HDR_LEN 100
|
|
||||||
#define MAX_IOB_LEN 1500
|
#define MAX_IOB_LEN 1500
|
||||||
#define MIN_IOB_LEN MAX_HDR_LEN + 100 /* To account for padding by LL */
|
#define MIN_IOB_LEN MAX_HDR_LEN + 100 /* To account for padding by LL */
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <ipxe/xfer.h>
|
#include <ipxe/xfer.h>
|
||||||
#include <ipxe/open.h>
|
#include <ipxe/open.h>
|
||||||
#include <ipxe/uri.h>
|
#include <ipxe/uri.h>
|
||||||
|
#include <ipxe/netdevice.h>
|
||||||
#include <ipxe/tcpip.h>
|
#include <ipxe/tcpip.h>
|
||||||
#include <ipxe/tcp.h>
|
#include <ipxe/tcp.h>
|
||||||
|
|
||||||
|
@ -483,14 +484,14 @@ static int tcp_xmit ( struct tcp_connection *tcp ) {
|
||||||
start_timer ( &tcp->timer );
|
start_timer ( &tcp->timer );
|
||||||
|
|
||||||
/* Allocate I/O buffer */
|
/* Allocate I/O buffer */
|
||||||
iobuf = alloc_iob ( len + MAX_HDR_LEN );
|
iobuf = alloc_iob ( len + MAX_LL_NET_HEADER_LEN );
|
||||||
if ( ! iobuf ) {
|
if ( ! iobuf ) {
|
||||||
DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x "
|
DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x "
|
||||||
"%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ),
|
"%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ),
|
||||||
tcp->rcv_ack );
|
tcp->rcv_ack );
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
iob_reserve ( iobuf, MAX_HDR_LEN );
|
iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
|
||||||
|
|
||||||
/* Fill data payload from transmit queue */
|
/* Fill data payload from transmit queue */
|
||||||
tcp_process_tx_queue ( tcp, len, iobuf, 0 );
|
tcp_process_tx_queue ( tcp, len, iobuf, 0 );
|
||||||
|
@ -627,14 +628,14 @@ static int tcp_xmit_reset ( struct tcp_connection *tcp,
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Allocate space for dataless TX buffer */
|
/* Allocate space for dataless TX buffer */
|
||||||
iobuf = alloc_iob ( MAX_HDR_LEN );
|
iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN );
|
||||||
if ( ! iobuf ) {
|
if ( ! iobuf ) {
|
||||||
DBGC ( tcp, "TCP %p could not allocate iobuf for RST "
|
DBGC ( tcp, "TCP %p could not allocate iobuf for RST "
|
||||||
"%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ),
|
"%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ),
|
||||||
ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) );
|
ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) );
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
iob_reserve ( iobuf, MAX_HDR_LEN );
|
iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
|
||||||
|
|
||||||
/* Construct RST response */
|
/* Construct RST response */
|
||||||
tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );
|
tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );
|
||||||
|
|
Loading…
Reference in New Issue