From: Victor Julien Date: Fri, 20 Dec 2013 13:34:48 +0000 (+0100) Subject: defrag: update radix usage X-Git-Tag: suricata-2.0rc1~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd91738a4b4d84f6191bb0081a8cf7fd7f6569fa;p=thirdparty%2Fsuricata.git defrag: update radix usage Update defrag timeout lookup to use the updated radix API. The return of user_data is treated as a succesful lookup, instead of the node. --- diff --git a/src/defrag-config.c b/src/defrag-config.c index d1b52a7c12..8fc5bdf7a5 100644 --- a/src/defrag-config.c +++ b/src/defrag-config.c @@ -70,21 +70,22 @@ static void DefragPolicyAddHostInfo(char *host_ip_range, uint64_t timeout) static int DefragPolicyGetIPv4HostTimeout(uint8_t *ipv4_addr) { - SCRadixNode *node = SCRadixFindKeyIPV4BestMatch(ipv4_addr, defrag_tree); - - if (node == NULL) + void *user_data = NULL; + (void)SCRadixFindKeyIPV4BestMatch(ipv4_addr, defrag_tree, &user_data); + if (user_data == NULL) return -1; - else - return *((int *)node->prefix->user_data_result); + + return *((int *)user_data); } static int DefragPolicyGetIPv6HostTimeout(uint8_t *ipv6_addr) { - SCRadixNode *node = SCRadixFindKeyIPV6BestMatch(ipv6_addr, defrag_tree); - if (node == NULL) + void *user_data = NULL; + (void)SCRadixFindKeyIPV6BestMatch(ipv6_addr, defrag_tree, &user_data); + if (user_data == NULL) return -1; - else - return *((int *)node->prefix->user_data_result); + + return *((int *)user_data); } int DefragPolicyGetHostTimeout(Packet *p)