missing case added

This commit is contained in:
hladu357 2024-06-08 09:04:34 +02:00
parent 9d2d565657
commit e224d1fb98
1 changed files with 10 additions and 1 deletions

View File

@ -85,7 +85,7 @@ int radix_insert(radix_holder_t t, ipv6_t key, int val, int mask) {
} }
/* exact match */ /* exact match */
if (node->_rule_valid) { if (node->_rule_valid && node->_ip_end_bit == mask) {
printf("WARNING: conflicting rule %x:%x:%x:%x:%x:%x:%x:%x", printf("WARNING: conflicting rule %x:%x:%x:%x:%x:%x:%x:%x",
key.s[0], key.s[1], key.s[2], key.s[3], key.s[0], key.s[1], key.s[2], key.s[3],
key.s[4], key.s[5], key.s[6], key.s[7]); key.s[4], key.s[5], key.s[6], key.s[7]);
@ -94,6 +94,15 @@ int radix_insert(radix_holder_t t, ipv6_t key, int val, int mask) {
return 0; return 0;
} }
/* match with lower mask */
if (node->_rule_valid) {
split_node(node, ibit);
b = GET_BIT(node->_ip, ibit + 1);
next = b ? &node->_r : &node->_l;
*next = NULL;
}
node->_rule_valid = VALID_RULE; node->_rule_valid = VALID_RULE;
node->_rule = val; node->_rule = val;
return 1; return 1;