From patchwork Tue Aug 23 21:06:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 111189 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 9BD8CB6F18 for ; Wed, 24 Aug 2011 07:18:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6F027280EE; Tue, 23 Aug 2011 23:14:27 +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 nZcYE-0fxY+a; Tue, 23 Aug 2011 23:14:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45CDC280EF; Tue, 23 Aug 2011 23:12:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE1DD280A5 for ; Tue, 23 Aug 2011 23:11:54 +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 l-MHNizmTil9 for ; Tue, 23 Aug 2011 23:11:39 +0200 (CEST) X-policyd-weight: SBL_XBL_SPAMHAUS=SKIP(-1.5) SPAMCOP=SKIP(-1.5) BL_NJABL=SKIP(-1.5) DSBL_ORG=ERR(0) IX_MANITU=ERR(0) (only DNSBL check requested) Received: from smtp145.dfw.emailsrvr.com (smtp145.dfw.emailsrvr.com [67.192.241.145]) by theia.denx.de (Postfix) with ESMTPS id 7A83D280CE for ; Tue, 23 Aug 2011 23:10:12 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp24.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 5A048180558; Tue, 23 Aug 2011 17:07:56 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp24.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id 14F7518051E; Tue, 23 Aug 2011 17:07:55 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Tue, 23 Aug 2011 16:07:48 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Tue, 23 Aug 2011 16:06:58 -0500 Message-Id: <1314133621-6488-11-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314133621-6488-1-git-send-email-jason.hobbs@calxeda.com> References: <1314133621-6488-1-git-send-email-jason.hobbs@calxeda.com> Subject: [U-Boot] [PATCH v4 10/13] 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 changes for v4: - Ensure pxeuuid contains a valid UUID string net/bootp.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 45eaab1..b04bb2b 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -370,6 +370,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; @@ -424,6 +429,41 @@ 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) { + if (uuid_str_valid(uuid)) { + *e++ = 97; /* Client Machine Identifier */ + *e++ = 17; + *e++ = 0; /* type 0 - UUID */ + + uuid_str_to_bin(uuid, e); + e += 16; + } else { + printf("Invalid pxeuuid: %s\n", uuid); + } + } + + *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;