* [U-Boot-Users] [PATCH] Add client id and class id to dhcp options
@ 2005-03-30 1:42 Kylo Ginsberg
2005-09-25 22:47 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Kylo Ginsberg @ 2005-03-30 1:42 UTC (permalink / raw)
To: u-boot
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.14 bootp.c
--- net/bootp.c 15 Apr 2004 21:48:49 -0000 1.14
+++ net/bootp.c 30 Mar 2005 01:14:17 -0000
@@ -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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot-Users] [PATCH] Add client id and class id to dhcp options
2005-03-30 1:42 [U-Boot-Users] [PATCH] Add client id and class id to dhcp options Kylo Ginsberg
@ 2005-09-25 22:47 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2005-09-25 22:47 UTC (permalink / raw)
To: u-boot
In message <424A03F0.7030703@veriwave.com> 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.14 bootp.c
> --- net/bootp.c 15 Apr 2004 21:48:49 -0000 1.14
> +++ net/bootp.c 30 Mar 2005 01:14:17 -0000
> @@ -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
--
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-25 22:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-30 1:42 [U-Boot-Users] [PATCH] Add client id and class id to dhcp options Kylo Ginsberg
2005-09-25 22:47 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox