]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[udp] Use MAX_LL_NET_HEADER_LEN instead of defining our own UDP_MAX_HLEN
authorMichael Brown <mcb30@ipxe.org>
Fri, 19 Nov 2010 15:45:41 +0000 (15:45 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 19 Nov 2010 16:08:05 +0000 (16:08 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/udp.h
src/net/udp.c

index c18a2972361aa2949a80be2e102daf5daac78fb5..ed0494763131c41052a492cdd422cea13ca8b628 100644 (file)
@@ -23,7 +23,6 @@ struct sockaddr;
  * UDP constants
  */
 
-#define UDP_MAX_HLEN   72
 #define UDP_MAX_TXIOB  ETH_MAX_MTU
 #define UDP_MIN_TXIOB  ETH_ZLEN
 
index 9bd80f3a35cc35b905bd2c583c050a29a416a4b4..5f452535ce43fdc207c4a5c0245687a467009733 100644 (file)
@@ -9,6 +9,7 @@
 #include <ipxe/xfer.h>
 #include <ipxe/open.h>
 #include <ipxe/uri.h>
+#include <ipxe/netdevice.h>
 #include <ipxe/udp.h>
 
 /** @file
@@ -197,7 +198,8 @@ static int udp_tx ( struct udp_connection *udp, struct io_buffer *iobuf,
        int rc;
 
        /* Check we can accommodate the header */
-       if ( ( rc = iob_ensure_headroom ( iobuf, UDP_MAX_HLEN ) ) != 0 ) {
+       if ( ( rc = iob_ensure_headroom ( iobuf,
+                                         MAX_LL_NET_HEADER_LEN ) ) != 0 ) {
                free_iob ( iobuf );
                return rc;
        }
@@ -361,13 +363,13 @@ static struct io_buffer * udp_xfer_alloc_iob ( struct udp_connection *udp,
                                               size_t len ) {
        struct io_buffer *iobuf;
 
-       iobuf = alloc_iob ( UDP_MAX_HLEN + len );
+       iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN + len );
        if ( ! iobuf ) {
                DBGC ( udp, "UDP %p cannot allocate buffer of length %zd\n",
                       udp, len );
                return NULL;
        }
-       iob_reserve ( iobuf, UDP_MAX_HLEN );
+       iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
        return iobuf;
 }