Browse Source

[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 years ago
parent
commit
5de4fba4f9
2 changed files with 5 additions and 4 deletions
  1. 0
    1
      src/include/ipxe/udp.h
  2. 5
    3
      src/net/udp.c

+ 0
- 1
src/include/ipxe/udp.h View File

23
  * UDP constants
23
  * UDP constants
24
  */
24
  */
25
 
25
 
26
-#define UDP_MAX_HLEN	72
27
 #define UDP_MAX_TXIOB	ETH_MAX_MTU
26
 #define UDP_MAX_TXIOB	ETH_MAX_MTU
28
 #define UDP_MIN_TXIOB	ETH_ZLEN
27
 #define UDP_MIN_TXIOB	ETH_ZLEN
29
 
28
 

+ 5
- 3
src/net/udp.c View File

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

Loading…
Cancel
Save