On Thu, 21 Mar 2019 17:18:41 +0800 Xiaolong Ye <xiaolong...@intel.com> wrote:
> + > + strlcpy(ifr.ifr_name, if_name, IFNAMSIZ); > + if (ioctl(sock, SIOCGIFINDEX, &ifr)) > + goto error; > + > + if (ioctl(sock, SIOCGIFHWADDR, &ifr)) > + goto error; > + > + rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); > + > + close(sock); > + *if_index = if_nametoindex(if_name); This seems confused: - first you get ifindex with SIOCGIFINDEX, then you ignore the result - then get MAC address. - then use if_nametoindex() which does SIOCGIFINDEX internally