From cd91738a4b4d84f6191bb0081a8cf7fd7f6569fa Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 20 Dec 2013 14:34:48 +0100 Subject: [PATCH] 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. --- src/defrag-config.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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)