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

Function get_ether_addr6

dpdk/lib/net/rte_ether.c:41–70  ·  view source on GitHub ↗

Convert 00:11:22:33:44:55 to ethernet address */

Source from the content-addressed store, hash-verified

39
40/* Convert 00:11:22:33:44:55 to ethernet address */
41static bool get_ether_addr6(const char *s0, struct rte_ether_addr *ea,
42 const char sep)
43{
44 const char *s = s0;
45 int i;
46
47 for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
48 int8_t x;
49
50 x = get_xdigit(*s++);
51 if (x < 0)
52 return false; /* not a hex digit */
53
54 ea->addr_bytes[i] = x;
55 if (*s != sep && *s != '\0') {
56 x = get_xdigit(*s++);
57 if (x < 0)
58 return false; /* not a hex digit */
59 ea->addr_bytes[i] <<= 4;
60 ea->addr_bytes[i] |= x;
61 }
62
63 if (i < RTE_ETHER_ADDR_LEN - 1 &&
64 *s++ != sep)
65 return false; /* premature end of string */
66 }
67
68 /* return true if no trailing characters */
69 return *s == '\0';
70}
71
72/* Convert 0011:2233:4455 to ethernet address */
73static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea,

Callers 1

rte_ether_unformat_addrFunction · 0.85

Calls 1

get_xdigitFunction · 0.85

Tested by

no test coverage detected