| 56 | } |
| 57 | |
| 58 | static int |
| 59 | ipv4_addr_cpy(rte_be32_t *spec, rte_be32_t *mask, char *token, |
| 60 | struct parse_status *status) |
| 61 | { |
| 62 | struct in_addr ip; |
| 63 | uint32_t depth; |
| 64 | |
| 65 | APP_CHECK(parse_ipv4_addr(token, &ip, &depth) == 0, status, |
| 66 | "unrecognized input \"%s\", expect valid ipv4 addr", token); |
| 67 | if (status->status < 0) |
| 68 | return -1; |
| 69 | |
| 70 | if (depth > 32) |
| 71 | return -1; |
| 72 | |
| 73 | memcpy(mask, &rte_flow_item_ipv4_mask.hdr.src_addr, sizeof(ip)); |
| 74 | |
| 75 | *spec = ip.s_addr; |
| 76 | |
| 77 | if (depth < 32) |
| 78 | *mask = htonl(*mask << (32 - depth)); |
| 79 | |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | static void |
| 84 | ipv6_hdr_print(struct rte_ipv6_hdr *hdr) |
no test coverage detected