Patchwork Support for VLAN tags

login
register
mail settings
Submitter Santiago Leon
Date Aug. 9, 2012, 1:57 p.m.
Message ID <5023C1D2.5060604@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/176125/
State Superseded
Headers show

Comments

Santiago Leon - Aug. 9, 2012, 1:57 p.m.
Adds support for booting from an IPv4 or IPv6 network with a VLAN tag.

Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
---

Patch

diff -urNp a/include/file.h b/include/file.h
--- a/include/file.h	2011-10-18 00:11:10.000000000 -0400
+++ b/include/file.h	2012-07-03 16:39:10.119814624 -0400
@@ -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 -urNp a/Makefile b/Makefile
diff -urNp a/second/file.c b/second/file.c
--- a/second/file.c	2011-10-18 00:11:10.000000000 -0400
+++ b/second/file.c	2012-07-18 22:28:57.529814947 -0400
@@ -163,9 +163,12 @@  extract_ipv4_args(char *imagepath, struc
 	  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);
+
      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 +334,9 @@  extract_ipv6_args(char *imagepath, struc
      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 -urNp a/second/fs_of.c b/second/fs_of.c
--- a/second/fs_of.c	2011-10-18 00:11:10.000000000 -0400
+++ b/second/fs_of.c	2012-07-18 20:46:10.619815172 -0400
@@ -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, ",");