From patchwork Tue May 17 04:29:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 95851 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 C18B0B6EEE for ; Tue, 17 May 2011 14:29:40 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C265228093; Tue, 17 May 2011 06:29:38 +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 ZSHYdjPho+HU; Tue, 17 May 2011 06:29:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9234728086; Tue, 17 May 2011 06:29:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6168B28086 for ; Tue, 17 May 2011 06:29:36 +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 VNeCDZhWrw61 for ; Tue, 17 May 2011 06:29:35 +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 mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.212.174]) by theia.denx.de (Postfix) with ESMTPS id 06C0028080 for ; Tue, 17 May 2011 06:29:33 +0200 (CEST) Received: by pxi15 with SMTP id 15so97535pxi.33 for ; Mon, 16 May 2011 21:29:31 -0700 (PDT) Received: by 10.68.58.38 with SMTP id n6mr377883pbq.5.1305606571418; Mon, 16 May 2011 21:29:31 -0700 (PDT) Received: from localhost.localdomain (gate1.alliedtelesyn.co.nz [202.49.72.36]) by mx.google.com with ESMTPS id w1sm120558pbf.1.2011.05.16.21.29.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2011 21:29:30 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Tue, 17 May 2011 16:29:19 +1200 Message-Id: <1305606559-29993-1-git-send-email-judge.packham@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: Cc: Luuk Paulussen , biggerbadderben@gmail.com Subject: [U-Boot] [PATCHv3] bootp: add ntpserver option to bootp request 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 From: Luuk Paulussen Signed-off-by: Luuk Paulussen Acked-by: Chris Packham Cc: Ben Warren --- Changes since v1: - fixed compile error in BootpVendorProcess when CONFIG_CMD_SNTP is not defined Changes since v2: - run though checkpatch.pl. Address comments from Sergei. net/bootp.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 4db63cb..45eaab1 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -228,6 +228,11 @@ static void BootpVendorFieldProcess (u8 * ext) NetOurNISDomain[size] = 0; } break; +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER) + case 42: /* NTP server IP */ + NetCopyIP(&NetNtpServerIP, (IPaddr_t *) (ext + 2)); + break; +#endif /* Application layer fields */ case 43: /* Vendor specific info - Not yet supported */ /* @@ -278,6 +283,11 @@ static void BootpVendorProcess (u8 * ext, int size) if (NetBootFileSize) debug("NetBootFileSize: %d\n", NetBootFileSize); + +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER) + if (NetNtpServerIP) + debug("NetNtpServerIP : %pI4\n", &NetNtpServerIP); +#endif } /* * Handle a BOOTP received packet. @@ -538,6 +548,11 @@ static int BootpExtended (u8 * e) *e++ = 32; e += 32; #endif +#if defined(CONFIG_BOOTP_NTPSERVER) + *e++ = 42; + *e++ = 4; + e += 4; +#endif *e++ = 255; /* End of the list */