mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-19 01:28:44 +00:00
Fixes a bug in pair sets.
This commit is contained in:
parent
a58022a64e
commit
2dec1e3471
@ -119,6 +119,13 @@ static inline int int_cmp(int i1, int i2)
|
|||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int uint_cmp(unsigned int i1, unsigned int i2)
|
||||||
|
{
|
||||||
|
if (i1 == i2) return 0;
|
||||||
|
if (i1 < i2) return -1;
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* val_compare - compare two values
|
* val_compare - compare two values
|
||||||
* @v1: first value
|
* @v1: first value
|
||||||
@ -144,9 +151,9 @@ val_compare(struct f_val v1, struct f_val v2)
|
|||||||
#ifndef IPV6
|
#ifndef IPV6
|
||||||
/* IP->Quad implicit conversion */
|
/* IP->Quad implicit conversion */
|
||||||
if ((v1.type == T_QUAD) && (v2.type == T_IP))
|
if ((v1.type == T_QUAD) && (v2.type == T_IP))
|
||||||
return int_cmp(v1.val.i, ipa_to_u32(v2.val.px.ip));
|
return uint_cmp(v1.val.i, ipa_to_u32(v2.val.px.ip));
|
||||||
if ((v1.type == T_IP) && (v2.type == T_QUAD))
|
if ((v1.type == T_IP) && (v2.type == T_QUAD))
|
||||||
return int_cmp(ipa_to_u32(v1.val.px.ip), v2.val.i);
|
return uint_cmp(ipa_to_u32(v1.val.px.ip), v2.val.i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug( "Types do not match in val_compare\n" );
|
debug( "Types do not match in val_compare\n" );
|
||||||
@ -156,9 +163,10 @@ val_compare(struct f_val v1, struct f_val v2)
|
|||||||
case T_ENUM:
|
case T_ENUM:
|
||||||
case T_INT:
|
case T_INT:
|
||||||
case T_BOOL:
|
case T_BOOL:
|
||||||
|
return int_cmp(v1.val.i, v2.val.i);
|
||||||
case T_PAIR:
|
case T_PAIR:
|
||||||
case T_QUAD:
|
case T_QUAD:
|
||||||
return int_cmp(v1.val.i, v2.val.i);
|
return uint_cmp(v1.val.i, v2.val.i);
|
||||||
case T_IP:
|
case T_IP:
|
||||||
return ipa_compare(v1.val.px.ip, v2.val.px.ip);
|
return ipa_compare(v1.val.px.ip, v2.val.px.ip);
|
||||||
case T_PREFIX:
|
case T_PREFIX:
|
||||||
|
Loading…
Reference in New Issue
Block a user