@@ -520,7 +520,7 @@ static int compare_match_exactness(const struct wolfsentry_route *target, const
520520 } else
521521#endif
522522 {
523- right_match_score = addr_prefix_match_size (WOLFSENTRY_ROUTE_LOCAL_ADDR (target ), WOLFSENTRY_ROUTE_LOCAL_ADDR_BITS (target ), WOLFSENTRY_ROUTE_LOCAL_ADDR (right ), WOLFSENTRY_ROUTE_LOCAL_ADDR_BITS (right ));
523+ right_match_score = addr_prefix_match_size (WOLFSENTRY_ROUTE_REMOTE_ADDR (target ), WOLFSENTRY_ROUTE_REMOTE_ADDR_BITS (target ), WOLFSENTRY_ROUTE_REMOTE_ADDR (right ), WOLFSENTRY_ROUTE_REMOTE_ADDR_BITS (right ));
524524 }
525525 }
526526
@@ -2562,9 +2562,11 @@ static wolfsentry_errcode_t wolfsentry_route_event_dispatch_0(
25622562 (WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .derogatory_count )
25632563 >= config -> config .derogatory_threshold_for_penaltybox )
25642564 :
2565- (WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .derogatory_count )
2566- - WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .commendable_count )
2567- >= (int )config -> config .derogatory_threshold_for_penaltybox )))
2565+ ((WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .derogatory_count )
2566+ >= WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .commendable_count ))
2567+ && ((wolfsentry_hitcount_t )(WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .derogatory_count )
2568+ - WOLFSENTRY_ATOMIC_LOAD (rule_route -> meta .commendable_count ))
2569+ >= config -> config .derogatory_threshold_for_penaltybox ))))
25682570 {
25692571 wolfsentry_route_flags_t flags_before ;
25702572 WOLFSENTRY_WARN_ON_FAILURE (
@@ -2961,6 +2963,10 @@ static wolfsentry_errcode_t wolfsentry_route_event_dispatch_by_route_1(
29612963 WOLFSENTRY_ERROR_UNLOCK_AND_RERETURN (ret );
29622964 }
29632965
2966+ if (route -> header .parent_table == NULL ) {
2967+ ret = WOLFSENTRY_ERROR_ENCODE (INTERNAL_CHECK_FATAL );
2968+ goto out ;
2969+ }
29642970 if (route -> header .parent_table -> ent_type != WOLFSENTRY_OBJECT_TYPE_ROUTE ) {
29652971 ret = WOLFSENTRY_ERROR_ENCODE (WRONG_OBJECT );
29662972 goto out ;
@@ -3095,7 +3101,7 @@ static wolfsentry_errcode_t wolfsentry_route_stale_purge_1(
30953101 (! (route -> flags & WOLFSENTRY_ROUTE_FLAG_PENDING_DELETE )) &&
30963102 ((table -> max_purgeable_idle_time == 0 ) || (now - route -> meta .last_hit_time > table -> max_purgeable_idle_time )))
30973103 {
3098- continue ;
3104+ break ;
30993105 }
31003106 }
31013107#ifdef WOLFSENTRY_THREADSAFE
0 commit comments