В письме от 21 августа 2013 22:58:48 Вы написали:
Среда, 21 августа 2013, 20:46 +02:00 от Ondrej Zajicek <santiago@crfreenet.org>:
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.
Huge thanks! Tested and found working!
There are at least one other caveat related to comparison, not covered by this patch: How to determine if clist, eclist are empty? Statements like bgp_community_list = -empty- or bgp_ext_community_list = --empty-- gives filter runtime error. Same reason for comparing bgppath type with +empty+ (i.e. bgp_path = +empty+), however for this we could use something like bgp_path.len = 0)? Interesting thing about comparison I found in filter/test.conf2: clist ~ [(*,*)] but this is not documented. So I consider to submit my attempt to address this caveat and add some other useful things related to comparison: * Move same_tree() for SET comparison and trie_same() for PREFIX_SET comparison into val_compare(). Now statements like bgp_community_list = -empty- and bgp_ext_community = --empty-- works. I think this could be done as there at least one function, that violates return code of val_compare() (-1,0,1): pm_path_compare(). * Intdodoce list_compare() to compare clist and eclist as arrays of u32, not much useful, but I think it does not broke something. This is done to extend val_compare() to handle all known filter types (probably). * Introduce path_compare() to compare bgppath type. Compares path length, and element by element, considering AS_PATH_SET more longer. Reason for adding same as with list_compare(). * Add minor optimisations on speed when comparing with int_cmp(), uint_cmp(), u64_cmp(), by removing branching. * Split comparison to T_VOID in val_compare() in two parts, when types are equal (add case to switch) and when are not. Do similar in val_in_range(). * Document -empty-, --empty-- and +empty+ special purpose constants. Also document S.empty statement for use with dynamic attributes. Another patch, just adds some other possibilities to check length of clist, eclist and ip address. Last could be used to determine AFI for which bird is build (see example function in documentation section on patch). Patches tested, and found working, at least for me. -- SP5474-RIPE Sergey Popovich