summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2003-02-27 11:48:30 +0100
committerMartin Mares <mj@ucw.cz>2003-02-27 11:48:30 +0100
commitd85e1f0e2f389d273ff14e89faced390b76d842b (patch)
tree291b380d60d8e200f66cb8b5592891fd3696ae53
parent6ea8ca1469a9c9150a4e0be9f8e6ab025eee990a (diff)
downloadbird-d85e1f0e2f389d273ff14e89faced390b76d842b.tar
bird-d85e1f0e2f389d273ff14e89faced390b76d842b.zip
Prefix comparison bug (hopefully) fixed.
-rw-r--r--filter/filter.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 25711c5..a50dce6 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -81,6 +81,8 @@ pm_path_compare(struct f_path_mask *m1, struct f_path_mask *m2)
int
val_compare(struct f_val v1, struct f_val v2)
{
+ int rc;
+
if ((v1.type == T_VOID) && (v2.type == T_VOID))
return 0;
if (v1.type == T_VOID) /* Hack for else */
@@ -100,8 +102,15 @@ val_compare(struct f_val v1, struct f_val v2)
if (v1.val.i < v2.val.i) return -1;
return 1;
case T_IP:
- case T_PREFIX:
return ipa_compare(v1.val.px.ip, v2.val.px.ip);
+ case T_PREFIX:
+ if (rc = ipa_compare(v1.val.px.ip, v2.val.px.ip))
+ return rc;
+ if (v1.val.px.len < v2.val.px.len)
+ return -1;
+ if (v1.val.px.len > v2.val.px.len)
+ return 1;
+ return 0;
case T_PATH_MASK:
return pm_path_compare(v1.val.path_mask, v2.val.path_mask);
default: