All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kylo Ginsberg <kylo@veriwave.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Add client id and class id to dhcp options
Date: Tue, 29 Mar 2005 17:42:08 -0800	[thread overview]
Message-ID: <424A03F0.7030703@veriwave.com> (raw)

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;

             reply	other threads:[~2005-03-30  1:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30  1:42 Kylo Ginsberg [this message]
2005-09-25 22:47 ` [U-Boot-Users] [PATCH] Add client id and class id to dhcp options Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=424A03F0.7030703@veriwave.com \
    --to=kylo@veriwave.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.