Ver código fonte

[udp] Use MAX_LL_NET_HEADER_LEN instead of defining our own UDP_MAX_HLEN

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 anos atrás
pai
commit
5de4fba4f9
2 arquivos alterados com 5 adições e 4 exclusões
  1. 0
    1
      src/include/ipxe/udp.h
  2. 5
    3
      src/net/udp.c

+ 0
- 1
src/include/ipxe/udp.h Ver arquivo

@@ -23,7 +23,6 @@ struct sockaddr;
23 23
  * UDP constants
24 24
  */
25 25
 
26
-#define UDP_MAX_HLEN	72
27 26
 #define UDP_MAX_TXIOB	ETH_MAX_MTU
28 27
 #define UDP_MIN_TXIOB	ETH_ZLEN
29 28
 

+ 5
- 3
src/net/udp.c Ver arquivo

@@ -9,6 +9,7 @@
9 9
 #include <ipxe/xfer.h>
10 10
 #include <ipxe/open.h>
11 11
 #include <ipxe/uri.h>
12
+#include <ipxe/netdevice.h>
12 13
 #include <ipxe/udp.h>
13 14
 
14 15
 /** @file
@@ -197,7 +198,8 @@ static int udp_tx ( struct udp_connection *udp, struct io_buffer *iobuf,
197 198
 	int rc;
198 199
 
199 200
 	/* Check we can accommodate the header */
200
-	if ( ( rc = iob_ensure_headroom ( iobuf, UDP_MAX_HLEN ) ) != 0 ) {
201
+	if ( ( rc = iob_ensure_headroom ( iobuf,
202
+					  MAX_LL_NET_HEADER_LEN ) ) != 0 ) {
201 203
 		free_iob ( iobuf );
202 204
 		return rc;
203 205
 	}
@@ -361,13 +363,13 @@ static struct io_buffer * udp_xfer_alloc_iob ( struct udp_connection *udp,
361 363
 					       size_t len ) {
362 364
 	struct io_buffer *iobuf;
363 365
 
364
-	iobuf = alloc_iob ( UDP_MAX_HLEN + len );
366
+	iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN + len );
365 367
 	if ( ! iobuf ) {
366 368
 		DBGC ( udp, "UDP %p cannot allocate buffer of length %zd\n",
367 369
 		       udp, len );
368 370
 		return NULL;
369 371
 	}
370
-	iob_reserve ( iobuf, UDP_MAX_HLEN );
372
+	iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
371 373
 	return iobuf;
372 374
 }
373 375
 

Carregando…
Cancelar
Salvar