From patchwork Fri Jun 10 21:06:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 99951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5C930B703C for ; Sat, 11 Jun 2011 07:07:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ED212282EB; Fri, 10 Jun 2011 23:06:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4dCOW6lbMbxG; Fri, 10 Jun 2011 23:06:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E2E74282C2; Fri, 10 Jun 2011 23:06:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 04170282D3 for ; Fri, 10 Jun 2011 23:06:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VWcIDLI+61GM for ; Fri, 10 Jun 2011 23:06:52 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp165.dfw.emailsrvr.com (smtp165.dfw.emailsrvr.com [67.192.241.165]) by theia.denx.de (Postfix) with ESMTPS id 12BFB282C3 for ; Fri, 10 Jun 2011 23:06:51 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp16.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 71FC840BF1; Fri, 10 Jun 2011 17:06:49 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp16.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id 493A9404E8; Fri, 10 Jun 2011 17:06:48 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Fri, 10 Jun 2011 16:06:45 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Fri, 10 Jun 2011 16:06:39 -0500 Message-Id: <1307740000-27388-2-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1307740000-27388-1-git-send-email-jason.hobbs@calxeda.com> References: <1307740000-27388-1-git-send-email-jason.hobbs@calxeda.com> Cc: Jason Hobbs , biggerbadderben@gmail.com Subject: [U-Boot] [PATCH v2 2/3] net: bootp: add PXE/RFC 4578 DHCP options support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de These options are required to be present in RFC 4578 compliant DHCP requests. They give more information to DHCP servers to allow serving different DHCP responses to different systems based on client architecture, client capabilities, UUID, or vendor. Signed-off-by: Jason Hobbs --- Changes for v2: - Use common.h to get uuid_str_to_bin prototype --- net/bootp.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 4db63cb..06ff598 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -360,6 +360,11 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R { u8 *start = e; u8 *cnt; +#if defined(CONFIG_BOOTP_PXE) + char *uuid; + size_t vci_strlen; + u16 clientarch; +#endif #if defined(CONFIG_BOOTP_VENDOREX) u8 *x; @@ -414,6 +419,37 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R } #endif +#if defined(CONFIG_BOOTP_PXE) + clientarch = CONFIG_BOOTP_PXE_CLIENTARCH; + *e++ = 93; /* Client System Architecture */ + *e++ = 2; + *e++ = (clientarch >> 8) & 0xff; + *e++ = clientarch & 0xff; + + *e++ = 94; /* Client Network Interface Identifier */ + *e++ = 3; + *e++ = 1; /* type field for UNDI */ + *e++ = 0; /* major revision */ + *e++ = 0; /* minor revision */ + + uuid = getenv("pxeuuid"); + + if (uuid) { + *e++ = 97; /* Client Machine Identifier */ + *e++ = 17; + *e++ = 0; /* type 0 - UUID */ + + uuid_str_to_bin(uuid, e); + e += 16; + } + + *e++ = 60; /* Vendor Class Identifier */ + vci_strlen = strlen(CONFIG_BOOTP_VCI_STRING); + *e++ = vci_strlen; + memcpy(e, CONFIG_BOOTP_VCI_STRING, vci_strlen); + e += vci_strlen; +#endif + #if defined(CONFIG_BOOTP_VENDOREX) if ((x = dhcp_vendorex_prep (e))) return x - start;