- if (mac) {
- r = sscanf(mac, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
- &new_mac.ether_addr_octet[0],
- &new_mac.ether_addr_octet[1],
- &new_mac.ether_addr_octet[2],
- &new_mac.ether_addr_octet[3],
- &new_mac.ether_addr_octet[4],
- &new_mac.ether_addr_octet[5]);
- if (r != 6)
- return -EINVAL;
- r = sd_rtnl_message_append(message, IFLA_ADDRESS, &new_mac);
- if (r < 0)
- return r;
+ s = udev_device_get_sysattr_value(device, "addr_assign_type");
+ if (!s)
+ return true; /* if we don't know, assume it is permanent */
+ r = safe_atou(s, &type);
+ if (r < 0)
+ return true;