1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation.
3 * Copyright(c) 2014 6WIND S.A.
9 #include <sys/socket.h>
12 #include <rte_memcpy.h>
13 #include <rte_string_fns.h>
15 #include "pcap_osdep.h"
18 osdep_iface_index_get(const char *name)
20 return if_nametoindex(name);
24 osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac)
27 int if_fd = socket(AF_INET, SOCK_DGRAM, 0);
32 rte_strscpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
33 if (ioctl(if_fd, SIOCGIFHWADDR, &ifr)) {
38 rte_memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);