From patchwork Mon Jun 6 18:49:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 98996 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 66E37B6FAF for ; Tue, 7 Jun 2011 04:57:10 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CBCD42815B; Mon, 6 Jun 2011 20:56:59 +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 TqfVecSoMSsg; Mon, 6 Jun 2011 20:56:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 572522815D; Mon, 6 Jun 2011 20:56:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 248502814D for ; Mon, 6 Jun 2011 20:56:40 +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 nDGGI+YDf+er for ; Mon, 6 Jun 2011 20:56:38 +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 D302028130 for ; Mon, 6 Jun 2011 20:56:37 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp16.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 1D29940613; Mon, 6 Jun 2011 14:50:34 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp16.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id EAD434023F; Mon, 6 Jun 2011 14:50:32 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Mon, 06 Jun 2011 13:50:27 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Mon, 6 Jun 2011 13:49:16 -0500 Message-Id: <1307386157-3660-3-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1307386157-3660-1-git-send-email-jason.hobbs@calxeda.com> References: <1307386157-3660-1-git-send-email-jason.hobbs@calxeda.com> Cc: Jason Hobbs , biggerbadderben@gmail.com Subject: [U-Boot] [PATCH 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 --- net/bootp.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 4db63cb..7748f58 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -14,6 +14,7 @@ #include "bootp.h" #include "tftp.h" #include "nfs.h" +#include "uuid.h" #ifdef CONFIG_STATUS_LED #include #endif @@ -360,6 +361,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 +420,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;