]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/net/drivers/ieee1275/ofnet.c: Get proper mac address when using qemu.
authorAvik Sil <aviksil@in.ibm.com>
Wed, 14 Aug 2013 21:03:01 +0000 (18:03 -0300)
committerPaulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Wed, 14 Aug 2013 21:03:01 +0000 (18:03 -0300)
ChangeLog
grub-core/net/drivers/ieee1275/ofnet.c

index 751f7108d4ad946fb6984f97ae8de27d36425264..295b2adcd20c0875bca1b9b5de8078358314ead2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-14  Avik Sil <aviksil@in.ibm.com>
+
+       * grub-core/net/drivers/ieee1275/ofnet.c: Get proper mac address when
+       using qemu.
+
 2013-08-14  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
 
        * .bzrignore: Add bootinfo.txt, grub.chrp, gnulib/float.h, and
index 21b62141a5362cd8a3ea7558f26f0156adb22d26..7ecc05571b5a01ec78e6cdef212a776c7b7e3363 100644 (file)
@@ -202,6 +202,9 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
   struct grub_net_card *card;
   grub_ieee1275_phandle_t devhandle;
   grub_net_link_level_address_t lla;
+  grub_ssize_t prop_size;
+  grub_uint64_t prop;
+  grub_uint8_t *pprop;
   char *shortname;
 
   if (grub_strcmp (alias->type, "network") != 0)
@@ -235,16 +238,22 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
       card->mtu = t;
   }
 
+  pprop = (grub_uint8_t *) &prop;
   if (grub_ieee1275_get_property (devhandle, "mac-address",
-                                 &(lla.mac), 6, 0)
+                                 pprop, sizeof(prop), &prop_size)
       && grub_ieee1275_get_property (devhandle, "local-mac-address",
-                                    &(lla.mac), 6, 0))
+                                    pprop, sizeof(prop), &prop_size))
     {
       grub_error (GRUB_ERR_IO, "Couldn't retrieve mac address.");
       grub_print_error ();
       return 0;
     }
 
+  if (prop_size == 8)
+    grub_memcpy (&lla.mac, pprop+2, 6);
+  else
+    grub_memcpy (&lla.mac, pprop, 6);
+
   lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
   card->default_address = lla;