Print this page
2553 mac address should be a dladm link property

@@ -2987,10 +2987,12 @@
                 minsize = sizeof (wl_key_t);
                 break;
         case MAC_PROP_WL_MLME:
                 minsize = sizeof (wl_mlme_t);
                 break;
+        case MAC_PROP_MACADDRESS:
+                minsize = sizeof (mac_addrprop_t);
         }
 
         return (valsize >= minsize);
 }
 

@@ -3063,10 +3065,20 @@
                         mip->mi_ldecay = learnval;
                 err = 0;
                 break;
         }
 
+        case MAC_PROP_MACADDRESS: {
+                mac_addrprop_t  *addrprop = val;
+
+                if (addrprop->ma_len != mip->mi_type->mt_addr_length)
+                        return (EINVAL);
+
+                err = mac_unicast_primary_set(mh, addrprop->ma_addr);
+                break;
+        }
+
         default:
                 /* For other driver properties, call driver's callback */
                 if (mip->mi_callbacks->mc_callbacks & MC_SETPROP) {
                         err = mip->mi_callbacks->mc_setprop(mip->mi_driver,
                             name, id, valsize, val);

@@ -3178,10 +3190,20 @@
                  * The value for these properties are returned through
                  * the MAC_PROP_RESOURCE property.
                  */
                 return (0);
 
+        case MAC_PROP_MACADDRESS: {
+                mac_addrprop_t  *addrprop = val;
+
+                if (valsize < sizeof (mac_addrprop_t))
+                        return (EINVAL);
+                mac_unicast_primary_get(mh, addrprop->ma_addr);
+                addrprop->ma_len = mip->mi_type->mt_addr_length;
+                return (0);
+        }
+
         default:
                 break;
 
         }
 

@@ -3331,10 +3353,23 @@
 
         case MAC_PROP_STATUS:
                 if (perm != NULL)
                         *perm = MAC_PROP_PERM_READ;
                 return (0);
+
+        case MAC_PROP_MACADDRESS: {
+                mac_addrprop_t  *defaddr = default_val;
+
+                if (defaddr != NULL) {
+                        if (default_size < sizeof (mac_addrprop_t))
+                                return (EINVAL);
+                        bcopy(mip->mi_info.mi_unicst_addr, defaddr->ma_addr,
+                            mip->mi_type->mt_addr_length);
+                        defaddr->ma_len = mip->mi_type->mt_addr_length;
+                }
+                return (0);
+        }
         }
 
         /*
          * Get the property info from the driver if it implements the
          * property info entry point.