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

Function ipv4_addr_cpy

dpdk/examples/ipsec-secgw/flow.c:58–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static int
59ipv4_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
83static void
84ipv6_hdr_print(struct rte_ipv6_hdr *hdr)

Callers 1

parse_flow_tokensFunction · 0.85

Calls 2

parse_ipv4_addrFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected