Re: [Etherboot-developers] MAX_BOOTP_EXTLEN in Etherboot 5.0.3
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: <ke...@us...> - 2001-09-24 05:34:55
|
>Etherboot's definition and use of MAX_BOOTP_EXTLEN is actually
>quite confusing; it is used to determine the size of the
>bootp_extension[] array in struct bootpd_t yet its value includes
>the size of the IP and UDP headers. These certainly aren't part of
>bootp_extension[]. I have included a patch below that changes
>MAX_BOOTP_EXTLEN to actually mean the maximum bootp extension
>length.
Ah ok, I see what you mean. I've done it this way.
diff -u ../../etherboot-5.0.4/src/etherboot.h ./etherboot.h
--- ../../etherboot-5.0.4/src/etherboot.h Thu Aug 2 10:15:20 2001
+++ ./etherboot.h Mon Sep 24 15:29:20 2001
@@ -76,7 +76,7 @@
#ifdef BOOTP_DATA_AT_0x93C00
#define MAX_BOOTP_EXTLEN (1024-sizeof(struct bootp_t))
#else
-#define MAX_BOOTP_EXTLEN (ETH_FRAME_LEN-ETH_HLEN-sizeof(struct bootp_t))
+#define MAX_BOOTP_EXTLEN (ETH_MAX_MTU-sizeof(struct bootpip_t))
#endif
#ifndef MAX_ARP_RETRIES
@@ -117,6 +117,7 @@
/*#define ETH_MIN_PACKET 64*/
#define ETH_FRAME_LEN 1514 /* Maximum packet */
/*#define ETH_MAX_PACKET 1518*/
+#define ETH_MAX_MTU (ETH_FRAME_LEN-ETH_HLEN)
#define ARP_CLIENT 0
#define ARP_SERVER 1
diff -u ../../etherboot-5.0.4/src/main.c ./main.c
--- ../../etherboot-5.0.4/src/main.c Thu Aug 9 23:09:38 2001
+++ ./main.c Mon Sep 24 15:30:25 2001
@@ -67,7 +67,7 @@
static const unsigned char dhcpdiscover[] = {
RFC2132_MSG_TYPE,1,DHCPDISCOVER,
RFC2132_MAX_SIZE,2, /* request as much as we can */
- sizeof(struct bootpd_t) / 256, sizeof(struct bootpd_t) % 256,
+ ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
RFC2132_VENDOR_CLASS_ID,13,'E','t','h','e','r','b','o','o','t',
'-',VERSION_MAJOR+'0','.',VERSION_MINOR+'0',
RFC2132_PARAM_LIST,4,RFC1533_NETMASK,RFC1533_GATEWAY,
@@ -78,7 +78,7 @@
RFC2132_SRV_ID,4,0,0,0,0,
RFC2132_REQ_ADDR,4,0,0,0,0,
RFC2132_MAX_SIZE,2, /* request as much as we can */
- sizeof(struct bootpd_t) / 256, sizeof(struct bootpd_t) % 256,
+ ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
RFC2132_VENDOR_CLASS_ID,13,'E','t','h','e','r','b','o','o','t',
'-',VERSION_MAJOR+'0','.',VERSION_MINOR+'0',
/* request parameters */
>However, it would be nicer to just interpret RFC2132 in the way that
>is most likely to work with all servers :-)
But then there would be no incentive to fix bugs. :-)
>>Just curious, why is bootpd sending the maximum packet all the time? Is
>>it padding the packet with nulls? Surely the clever thing to do would be
>>to send only as big a packet as needed.
>
>I'm not sure, but I would guess that it dates back to before the
>Maximum DHCP Message Size option existed. The bootpd code in FreeBSD
>hasn't changed much since 1994 anyway. It looks as if the old
>(probably unofficial) way for a bootp client to specify that it
>could handle a long bootp reply was for it to send a request packet
>that was as long as the maximum reply it would accept. The bootpd
>code just changed the request into a reply and resent it without
>changing the length. I guess when support for the DHCP max message
>size was added, this mechanism was still used.
Sounds like they were too lazy to trim the message size down and to
check the size against the interface's MTU. :-(
|