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

Function rte_ether_unformat_addr

dpdk/lib/net/rte_ether.c:133–155  ·  view source on GitHub ↗

* Be liberal in accepting a wide variety of notational formats * for MAC address including: * - Linux format six groups of hexadecimal digits separated by colon * - Windows format six groups separated by hyphen * - two groups hexadecimal digits */

Source from the content-addressed store, hash-verified

131 * - two groups hexadecimal digits
132 */
133int
134rte_ether_unformat_addr(const char *s, struct rte_ether_addr *ea)
135{
136 unsigned int count;
137 char sep = '\0';
138
139 count = get_ether_sep(s, &sep);
140 switch (count) {
141 case 5: /* i.e 01:23:45:67:89:AB */
142 if (get_ether_addr6(s, ea, sep))
143 return 0;
144 break;
145 case 2: /* i.e 0123.4567.89AB */
146 if (get_ether_addr3(s, ea, sep))
147 return 0;
148 break;
149 default:
150 break;
151 }
152
153 rte_errno = EINVAL;
154 return -1;
155}

Callers 15

eth_mac_cmpFunction · 0.85
cmdline_parse_etheraddrFunction · 0.85
memif_set_macFunction · 0.85
virtio_user_dev_init_macFunction · 0.85
mana_get_ifnameFunction · 0.85
mana_arg_parse_callbackFunction · 0.85
get_port_macFunction · 0.85
cpfl_check_eth_maskFunction · 0.85
fs_get_mac_addr_argFunction · 0.85
set_mac_typeFunction · 0.85
vdev_netvsc_netvsc_probeFunction · 0.85

Calls 3

get_ether_sepFunction · 0.85
get_ether_addr6Function · 0.85
get_ether_addr3Function · 0.85

Tested by 5

test_format_addrFunction · 0.68
test_unformat_addrFunction · 0.68
test_invalid_addrFunction · 0.68
ipv4_frag_fill_dataFunction · 0.68
ipv6_frag_fill_dataFunction · 0.68