This patch is the third of three, designed to allow access to the 
permanent hardware address of a network device.  This patch adds a new 
ioctl to get the field, "perm_addr," which was added to net_device by
the first patch.  

Signed-off-by: Jon Wetzel <[EMAIL PROTECTED]>

--- linux-2.6.12.2/include/linux/sockios.h      2005-06-29 18:00:53.000000000 
-0500
+++ linux-2.6.12.2-jw/include/linux/sockios.h   2005-07-12 08:44:36.000000000 
-0500
@@ -54,6 +54,7 @@
 #define SIOCGIFENCAP   0x8925          /* get/set encapsulations       */
 #define SIOCSIFENCAP   0x8926          
 #define SIOCGIFHWADDR  0x8927          /* Get hardware address         */
+#define SIOCGIFPERMADDR 0x8928         /* Get permanent hardware address */
 #define SIOCGIFSLAVE   0x8929          /* Driver slaving support       */
 #define SIOCSIFSLAVE   0x8930
 #define SIOCADDMULTI   0x8931          /* Multicast address lists      */
--- linux-2.6.12.2/net/core/dev.c       2005-06-29 18:00:53.000000000 -0500
+++ linux-2.6.12.2-jw/net/core/dev.c    2005-07-11 12:59:02.000000000 -0500
@@ -2387,6 +2387,15 @@
                        ifr->ifr_hwaddr.sa_family = dev->type;
                        return 0;
 
+               case SIOCGIFPERMADDR:
+                       if (!dev->addr_len)
+                               memset(ifr->ifr_hwaddr.sa_data, 0, sizeof 
ifr->ifr_hwaddr.sa_data);
+                       else
+                               memcpy(ifr->ifr_hwaddr.sa_data, dev->perm_addr,
+                                      min(sizeof ifr->ifr_hwaddr.sa_data, 
(size_t) dev->addr_len));
+                       ifr->ifr_hwaddr.sa_family = dev->type;
+                       return 0;
+
                case SIOCSIFHWADDR:
                        return dev_set_mac_address(dev, &ifr->ifr_hwaddr);
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to