Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue on RP hash calculations. #93

Merged
merged 1 commit into from
Jun 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/rp.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ rp_grp_entry_t *rp_grp_match(uint32_t group)
uint32_t curr_hash_value = 0;
uint32_t curr_address_h = 0;
uint32_t group_h = ntohl(group);
uint32_t curr_hash_mask_h = 0;

if (grp_mask_list == NULL)
return NULL;
Expand All @@ -793,12 +794,13 @@ rp_grp_entry_t *rp_grp_match(uint32_t group)
!= ntohl(mask_ptr->group_mask & mask_ptr->group_addr))
continue;

curr_hash_mask_h = ntohl(mask_ptr->hash_mask);
for (entry_ptr = mask_ptr->grp_rp_next; entry_ptr; entry_ptr = entry_ptr->grp_rp_next) {
if (best_priority < entry_ptr->priority)
break;

curr_hash_value = RP_HASH_VALUE(group_h, mask_ptr->hash_mask, curr_address_h);
curr_address_h = ntohl(entry_ptr->rp->rpentry->address);
curr_hash_value = RP_HASH_VALUE(group_h, curr_hash_mask_h, curr_address_h);

if (best_priority == entry_ptr->priority) {
/* Compare the hash_value and then the addresses */
Expand Down