Hi Mike
I got the following with: GIT_URL=~/git/odp GIT_BRANCH=forrest LCOV=1 ./build.sh No html is generated in the publishing. ======================================================================= OpenDataPlane 1.10.1.0.git71.ga942cb4: helper/test/test-suite.log ======================================================================= # TOTAL: 9 # PASS: 8 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0 # ERROR: 0 .. contents:: :depth: 2 FAIL: cuckootable ================= cuckootable.c:213:odph_cuckoo_table_create():cuckoo hash table put_remove already exists cuckoo hash table creation failed cuckoo hash table test fail!! Thanks, Forrest From: Mike Holmes [mailto:[email protected]] Sent: Friday, July 15, 2016 20:26 To: Forrest Shi <[email protected]> Cc: Bill Fischofer <[email protected]>; lng-odp <[email protected]> Subject: Re: [lng-odp] [PATCH/API-NEXT 3/3] helper/ip: add ipv4/subnet parsing On 8 July 2016 at 04:14, <[email protected] <mailto:[email protected]> > wrote: From: Xuelin Shi <[email protected] <mailto:[email protected]> > parse an ipv4/subnet string like "192.168.1.0/24 <http://192.168.1.0/24> " into 3 values: ipv4-addr, subnet bit width and subnet mask Signed-off-by: Xuelin Shi <[email protected] <mailto:[email protected]> > --- helper/include/odp/helper/ip.h | 19 +++++++++++++++++++ helper/ip.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index 4cfc00f..dd538c9 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -233,6 +233,25 @@ typedef struct ODP_PACKED { int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str); /** + * Parse text string representing an IPv4 address or subnet + * + * String is of the format "XXX.XXX.XXX.XXX(/W)" where + * "XXX" is decimal value and "/W" is optional subnet length + * + * @param ip_net_str Pointer to IP address/subnet string to convert + * @param ip_addr Pointer to return IPv4 address, host endianness + * @param depth Pointer to subnet bit width + * @param subnet_mask Pointer to subnet mask + * + * @retval 0 on success of parsing both ip and subnet + * @retval 1 on success of parsing only ip + * @retval 2 on success of parsing only subnet + * @retval <0 on failure + */ +int odph_ipv4_subnet_parse(const char *ip_net_str, uint32_t *ip_addr, + uint32_t *depth, uint32_t *subnet_mask); This new api is not tested by the validation suite To see this in LCOV use check-odp and point at your repo and branch setting LCOV GIT_URL=~/git/odp GIT_BRANCH=forrest LCOV=1 ./build.sh firefox publishing/forrest/linux-generic-helper-lcov-html/helper/ip.c.gcov.html + +/** * @} */ #ifdef __cplusplus diff --git a/helper/ip.c b/helper/ip.c index e211001..d2ca21e 100644 --- a/helper/ip.c +++ b/helper/ip.c @@ -30,3 +30,36 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) return 0; } + +int odph_ipv4_subnet_parse(const char *ip_net_str, uint32_t *ip_addr, + uint32_t *depth, uint32_t *subnet_mask) +{ + char *s; + int converted; + uint32_t qualifier = 32; + char ip_valid = 0; + char subnet_valid = 0; + + s = strchr(ip_net_str, '/'); + if (s) { + converted = sscanf(s, "/%u", &qualifier); + if (converted == 1 && qualifier && qualifier <= 32) { + *depth = qualifier; + *subnet_mask = ((1 << qualifier) - 1) << + (32 - qualifier); + subnet_valid = 1; + } + } + + if (!odph_ipv4_addr_parse(ip_addr, ip_net_str)) + ip_valid = 1; + + if (ip_valid && subnet_valid) + return 0; + else if (ip_valid) + return 1; + else if (subnet_valid) + return 2; + else + return -1; +} -- 2.1.0.27.g96db324 -- Mike Holmes Technical Manager - Linaro Networking Group <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"
