bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] Set "vlan-tag" variable from OpenFirmware


From: Lubomir Rintel
Subject: [PATCH 3/4] Set "vlan-tag" variable from OpenFirmware
Date: Mon, 20 Jan 2014 22:29:11 +0100

From: Paulo Flabiano Smorigo <address@hidden>

This is useful with VLAN tagging support (will be submitted in a different
patch). VLAN tagging allows multiple VLANs in a bridged network to share the
same physical network link but maintain isolation:

Link: http://en.wikipedia.org/wiki/IEEE_802.1Q
Link: https://bugzilla.redhat.com/show_bug.cgi?id=871563

address@hidden: Clarified the commit message]
address@hidden: Split platform-dependent and independent parts]
address@hidden: Add Changelog]
---
 ChangeLog                        |  9 +++++++++
 grub-core/kern/ieee1275/init.c   |  1 +
 grub-core/kern/ieee1275/openfw.c | 30 ++++++++++++++++++++++++++++++
 include/grub/ieee1275/ieee1275.h |  1 +
 4 files changed, 41 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8bbb59f..23beb14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2014-01-20  Paulo Flabiano Smorigo  <address@hidden>
 
+       * grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Call
+       grub_ieee1275_parse_net_options.
+       * grub-core/kern/ieee1275/openfw.c: Include grub/env.h.
+       (grub_ieee1275_parse_net_options): Add.
+       * include/grub/ieee1275/ieee1275.h: Add
+       grub_ieee1275_parse_net_options prototype.
+
+2014-01-20  Paulo Flabiano Smorigo  <address@hidden>
+
        * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
        GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT flag if "model" property is
        "IBM".
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 89b2822..f43f6b9 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -118,6 +118,7 @@ grub_machine_get_bootlocation (char **device, char **path)
       char *dev, *canon;
       char *ptr;
       dev = grub_ieee1275_get_aliasdevname (bootpath);
+      grub_ieee1275_parse_net_options (bootpath);
       canon = grub_ieee1275_canonicalise_devname (dev);
       ptr = canon + grub_strlen (canon) - 1;
       while (ptr > canon && (*ptr == ',' || *ptr == ':'))
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 6db8b98..81276fa 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -23,6 +23,7 @@
 #include <grub/mm.h>
 #include <grub/ieee1275/ieee1275.h>
 #include <grub/net.h>
+#include <grub/env.h>
 
 enum grub_ieee1275_parse_type
 {
@@ -451,6 +452,35 @@ fail:
   return ret;
 }
 
+int
+grub_ieee1275_parse_net_options (const char *path)
+{
+  char *comma;
+  char *args;
+  char *option = 0;
+
+  args = grub_ieee1275_get_devargs (path);
+  if (!args)
+    /* There is no option.  */
+    return -1;
+
+  do
+    {
+      comma = grub_strchr (args, ',');
+      if (! comma)
+        option = grub_strdup (args);
+      else
+        option = grub_strndup (args, (grub_size_t)(comma - args));
+      args = comma + 1;
+
+      if (! grub_strncmp(option, "vtag", 4))
+          grub_env_set ("vlan-tag", option + grub_strlen("vtag="));
+
+    } while (comma);
+
+  return 0;
+}
+
 char *
 grub_ieee1275_get_device_type (const char *path)
 {
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index d31e1db..29f3a1d 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -237,6 +237,7 @@ void EXPORT_FUNC(grub_ieee1275_children_first) (const char 
*devpath,
                                                struct grub_ieee1275_devalias 
*alias);
 int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
 int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path);
 
 #define FOR_IEEE1275_DEVALIASES(alias) for 
(grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next 
(&(alias));)
 
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]