From patchwork Wed Aug 31 15:37:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 112590 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 7B258B6EE8 for ; Thu, 1 Sep 2011 01:40:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 970D62815F; Wed, 31 Aug 2011 17:39:37 +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 Lh0jdNJGw3RJ; Wed, 31 Aug 2011 17:39:37 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E92542816A; Wed, 31 Aug 2011 17:38:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B3ED928115 for ; Wed, 31 Aug 2011 17:38:35 +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 RFigeW3aXpth for ; Wed, 31 Aug 2011 17:38:34 +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 smtp205.dfw.emailsrvr.com (smtp205.dfw.emailsrvr.com [67.192.241.205]) by theia.denx.de (Postfix) with ESMTPS id 1255D28112 for ; Wed, 31 Aug 2011 17:38:16 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp10.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id B80C71B8678; Wed, 31 Aug 2011 11:38:15 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp10.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id 9932F1B84C5; Wed, 31 Aug 2011 11:38:14 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Wed, 31 Aug 2011 10:37:58 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Wed, 31 Aug 2011 10:37:31 -0500 Message-Id: <1314805054-16250-11-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314805054-16250-1-git-send-email-jason.hobbs@calxeda.com> References: <1314805054-16250-1-git-send-email-jason.hobbs@calxeda.com> Subject: [U-Boot] [PATCH v5 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 changes for v5: - none 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;