From patchwork Fri Mar 1 14:48:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santiago Leon X-Patchwork-Id: 224384 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id A39202C02FD for ; Sat, 2 Mar 2013 02:09:38 +1100 (EST) X-Greylist: delayed 1287 seconds by postgrey-1.34 at bilbo; Sat, 02 Mar 2013 02:09:35 EST Received: from uio2.ecua.net.ec (uio2.ecua.net.ec [157.100.45.15]) by ozlabs.org (Postfix) with ESMTP id B99062C02BE for ; Sat, 2 Mar 2013 02:09:34 +1100 (EST) Received: from [192.168.2.100] (unknown [186.4.150.130]) by uio2.ecua.net.ec (Postfix) with ESMTP id C6DD9104D9F; Fri, 1 Mar 2013 09:24:23 -0500 (ECT) Message-ID: <5130BFA4.1020802@linux.vnet.ibm.com> Date: Fri, 01 Mar 2013 09:48:04 -0500 From: Santiago Leon User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: yaboot-devel@lists.ozlabs.org Subject: [PATCH] Support for VLAN tags Cc: tonyb@au1.ibm.com X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Yaboot-devel" Adds support for booting from an IPv4 or IPv6 network with a VLAN tag. Signed-off-by: Santiago Leon --- include/file.h | 1 + second/file.c | 10 +++++++++- second/fs_of.c | 11 +++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/file.h b/include/file.h index b2d9c63..e2ccc13 100644 --- a/include/file.h +++ b/include/file.h @@ -47,6 +47,7 @@ struct boot_fspec_t { char* tftp_retries; /* TFTP retries */ char* subnetmask; /* Subnet mask */ char* addl_params; /* copy all additional parameters */ + char* vtag; /* VLAN tag */ /* Following fields are used only in ipv6 format */ int is_ipv6; /* is ipv6 specified ? */ diff --git a/second/file.c b/second/file.c index fd081a3..02b1872 100644 --- a/second/file.c +++ b/second/file.c @@ -163,9 +163,14 @@ extract_ipv4_args(char *imagepath, struct boot_fspec_t *result) args++; /* If comma(,) is not immediately followed by ':' then go past the , */ /* - * read the arguments in order: siaddr,filename,ciaddr,giaddr, + * read the arguments in order: vtag,siaddr,filename,ciaddr,giaddr, * bootp-retries,tftp-retries,addl_prameters */ + if ((tmp = strstr(imagepath, "vtag=")) != NULL) { + result->vtag = scopy(&str, &tmp); + args = tmp; + } + result->siaddr = is_valid_ipv4_str(scopy(&str, &args)); result->file = scopy(&str, &args); result->ciaddr = is_valid_ipv4_str(scopy(&str, &args)); @@ -331,6 +336,9 @@ extract_ipv6_args(char *imagepath, struct boot_fspec_t *result) if ((tmp = strstr(imagepath, "dhcpv6=")) != NULL) result->dhcpv6 = scopy(&str, &tmp); + if ((tmp = strstr(imagepath, "vtag=")) != NULL) + result->vtag = scopy(&str, &tmp); + if ((tmp = strstr(imagepath, "ciaddr=")) != NULL) result->ciaddr = scopy(&str, &tmp); diff --git a/second/fs_of.c b/second/fs_of.c index 77113b1..3a8819c 100644 --- a/second/fs_of.c +++ b/second/fs_of.c @@ -152,9 +152,9 @@ of_net_open(struct boot_file_t* file, } DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;" - " ipv6 <%d>\n", + " ipv6 <%d>; vtag <%s>\n", fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr, - fspec->is_ipv6); + fspec->is_ipv6, fspec->vtag); strncpy(buffer, fspec->dev, 768); /* If we didn't get a ':' include one */ @@ -169,6 +169,13 @@ of_net_open(struct boot_file_t* file, DEBUG_F("Using %s tftp style\n", (new_tftp? "new": "old")); if (new_tftp) { + if (fspec->is_ipv6) + strcat(buffer, "ipv6,"); + + if (fspec->vtag) { + strcat(buffer, fspec->vtag); + strcat(buffer, ","); + } strcat(buffer, fspec->siaddr); strcat(buffer, ",");