title: How to get network link L2 address via netlink?
body: <p>I'm using <code>netlink</code> to get interfaces, its names, types etc. but I can't get L2 address  (<code>ugly_data</code> is <code>nlmsghdr*</code>):</p>
  
  <pre><code>struct ifinfomsg *iface;
  struct rtattr *attribute;
  int len;
  
  iface = (struct ifinfomsg *) NLMSG_DATA(ugly_data);
  len = ugly_data-&gt;nlmsg_len - NLMSG_LENGTH(sizeof(*iface));
  
  for (attribute = IFLA_RTA(iface);
       RTA_OK(attribute, len);
       attribute = RTA_NEXT(attribute, len))
  {
    id_ = iface-&gt;ifi_index;
  
    // get type
    switch (iface-&gt;ifi_type)
    {
    case ARPHRD_ETHER:
      type_ = "Ethernet";
      break;
    case ...
    }
  
    // get attributes
    switch (attribute-&gt;rta_type)
    {
    case IFLA_IFNAME:
      name_ = (char *) RTA_DATA(attribute);
      break;
    case IFLA_ADDRESS:
      address_ = (char *) RTA_DATA(attribute);
      break;
     ...
    }
  }
  </code></pre>
  
  <p><code>type_</code>, <code>id_</code> and <code>name_</code> contain right values, same as I got from <code>ifconfig</code>, but <code>address_</code> is always empty. 
  What am I doing wrong and how to get addresses?</p>