Add client id and class id to dhcp options
PATCH 1/1 Add client id and class id to dhcp options
This patch adds the client identifier and class identifier options to dhcp. The former permits consistent address assignment from servers that key off the client identifier; the latter aids in debugging.
Index: net/bootp.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/bootp.c,v
retrieving revision 1.14
bootp.c 30 Mar 2005 01:14:17 -0000 renamed from bootp.c 15 Apr 2004 21:48:49 -0000 1.14 +0 -1
@@ -378,8 +378,11 @@ * Initialize BOOTP extension fields in the request. */ #if (CONFIG_COMMANDS & CFG_CMD_DHCP) -static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID,
IPaddr_t RequestedIP)
+static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t RequestedIP,
+ char *EtherAddr)
{
+ char *class_id = "U-boot";
+ int len;
u8 *start = e;
u8 *cnt;@@ -404,6 +407,23 @@
*e++ = (576 - 312 + OPT_SIZE) >> 8;
*e++ = (576 - 312 + OPT_SIZE) & 0xff;+ *e++ = 61; /* Client Identifier, use the MAC */
+ *e++ = 7;
+ *e++ = 1;
+ *e++ = EtherAddr[0];
+ *e++ = EtherAddr[1];
+ *e++ = EtherAddr[2];
+ *e++ = EtherAddr[3];
+ *e++ = EtherAddr[4];
+ *e++ = EtherAddr[5];
+
+ *e++ = 60; /* Class Identifier */
+ len = strlen(class_id);
+ *e++ = len;
+ /* don't use strcpy, we don't want the terminating 0 */
+ memcpy(e, class_id, len);
+ e += len;
+
if (ServerID) {
int tmp = ntohl (ServerID);@@ -671,7 +691,7 @@
/* Request additional information from the BOOTP/DHCP server */
#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
- ext_len = DhcpExtended(bp->bp_vend, DHCP_DISCOVER, 0, 0);
+ ext_len = DhcpExtended(bp->bp_vend, DHCP_DISCOVER, 0, 0,
NetOurEther);
#else
ext_len = BootpExtended(bp->bp_vend);
#endif /* CFG_CMD_DHCP */
@@ -817,7 +837,7 @@
* Copy options from OFFER packet if present
*/
NetCopyIP(&OfferedIP, &bp->bp_yiaddr);- extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST,
NetDHCPServerIP, OfferedIP);
+ extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST,
NetDHCPServerIP, OfferedIP, NetOurEther);
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;PATCH 1/1 Add client id and class id to dhcp options
Quoted 12 lines · In message <[email protected]> you wrote:
This patch adds the client identifier and class identifier options to dhcp. The former permits consistent address assignment from servers that key off the client identifier; the latter aids in debugging.
Index:
net/bootp.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/bootp.c,v
retrieving revision 1.14
diff -u -r1.14bootp.c
bootp.c 30 Mar 2005 01:14:17 -0000 line 383
Quoted 7 lines
bootp.c 30 Mar 2005 01:14:17 -0000 renamed from bootp.c 15 Apr 2004 21:48:49 -0000 1.14 +1
-1@@ -378,8 +378,11 @@ * Initialize BOOTP extension fields in the request. */ #if (CONFIG_COMMANDS & CFG_CMD_DHCP) -static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t RequestedIP) +static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t RequestedIP,
Your patch is broken and thus unusable as your mailer wrapped long lines. Please resubmit.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Like winter snow on summer lawn, time past is time gone.