Convert 00:11:22:33:44:55 to ethernet address */
| 39 | |
| 40 | /* Convert 00:11:22:33:44:55 to ethernet address */ |
| 41 | static 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 */ |
| 73 | static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea, |
no test coverage detected