On Wed, Aug 21, 2013 at 07:02:19PM +0300, Sergey Popovich wrote:
> Hello community!!
>
> And again I need to spread some light on BIRD behavior:
> why bird restarts protocol instead of just reloading it
> when no filter changes in configuration when using
> prefix set constant?
...
> Can some one explain to me this behavior of BIRD? Does this mean
> that usage of constats with type prefix set is not recommended?
Hello
This is just a stupid mistake. Sets were not properly compared.
Use attached patch.
--
Elen sila lumenn' omentielvo
Ondrej 'SanTiago' Zajicek (email: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
diff -uprN bird-1.3.11-/filter/filter.c bird-1.3.11/filter/filter.c
--- bird-1.3.11-/filter/filter.c 2013-07-28 20:48:28.000000000 +0200
+++ bird-1.3.11/filter/filter.c 2013-08-21 20:39:22.000000000 +0200
@@ -1365,8 +1365,31 @@ i_same(struct f_inst *f1, struct f_inst
}
break;
case 'C':
- if (val_compare(* (struct f_val *) f1->a1.p, * (struct f_val *) f2->a1.p))
- return 0;
+ {
+ struct f_val *v1 = (struct f_val *) f1->a1.p;
+ struct f_val *v2 = (struct f_val *) f2->a1.p;
+
+ /* Handle some cases that are not handled by val_compare()
+ also T_PATH, T_CLIST and T_ECLIST does not work,
+ but you cannot easily create such constants */
+
+ if ((v1->type == T_SET) && (v2->type == T_SET))
+ {
+ if (!same_tree(v1->val.t, v2->val.t))
+ return 0;
+ break;
+ }
+
+ if ((v1->type == T_PREFIX_SET) && (v2->type == T_PREFIX_SET))
+ {
+ if (!trie_same(v1->val.ti, v2->val.ti))
+ return 0;
+ break;
+ }
+
+ if (val_compare(*v1 , *v2))
+ return 0;
+ }
break;
case 'V':
if (strcmp((char *) f1->a2.p, (char *) f2->a2.p))