From: Ilya Yanok Date: Wed, 25 Jul 2012 02:22:21 +0400 Subject: [U-Boot] [PATCH v3 6/8] net/bootp: add VCI support for BOOTP also In-Reply-To: <1343168543-15500-1-git-send-email-ilya.yanok@cogentembedded.com> References: <1343168543-15500-1-git-send-email-ilya.yanok@cogentembedded.com> Message-ID: <1343168543-15500-7-git-send-email-ilya.yanok@cogentembedded.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Vendor Class Identifier option is common to BOOTP and DHCP and can be useful without PXE. So send VCI in both BOOTP and DHCP requests if CONFIG_BOOTP_VCI_STRING is defined. Signed-off-by: Ilya Yanok --- net/bootp.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 0f0867b..a68f914 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -339,6 +339,14 @@ BootpTimeout(void) } } +#define put_vci(e, str) \ + do { \ + *e++ = 60; \ + *e++ = sizeof(str); \ + memcpy(e, str, sizeof(str)); \ + e += sizeof(str); \ + } while (0) + /* * Initialize BOOTP extension fields in the request. */ @@ -435,12 +443,10 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID, printf("Invalid pxeuuid: %s\n", uuid); } } +#endif - *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; +#ifdef CONFIG_BOOTP_VCI_STRING + put_vci(e, CONFIG_VCI_STRING); #endif #if defined(CONFIG_BOOTP_VENDOREX) @@ -527,6 +533,10 @@ static int BootpExtended(u8 *e) *e++ = (576 - 312 + OPT_FIELD_SIZE) & 0xff; #endif +#ifdef CONFIG_BOOTP_VCI_STRING + put_vci(e, CONFIG_VCI_STRING); +#endif + #if defined(CONFIG_BOOTP_SUBNETMASK) *e++ = 1; /* Subnet mask request */ *e++ = 4; -- 1.7.9.5