MCPcopy Create free account
hub / github.com/F-Stack/f-stack / osdep_iface_mac_get

Function osdep_iface_mac_get

dpdk/drivers/net/pcap/pcap_osdep_linux.c:23–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23int
24osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac)
25{
26 struct ifreq ifr;
27 int if_fd = socket(AF_INET, SOCK_DGRAM, 0);
28
29 if (if_fd == -1)
30 return -1;
31
32 rte_strscpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
33 if (ioctl(if_fd, SIOCGIFHWADDR, &ifr)) {
34 close(if_fd);
35 return -1;
36 }
37
38 rte_memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);
39
40 close(if_fd);
41 return 0;
42}

Callers 1

eth_pcap_update_macFunction · 0.70

Calls 5

rte_strscpyFunction · 0.85
socketClass · 0.50
ioctlFunction · 0.50
closeFunction · 0.50
rte_memcpyFunction · 0.50

Tested by

no test coverage detected