Hello List, at the moment we try to implement an fine granulary filter mechanism in our Bird OSPF setup. We ask ourselfes if anyone has implementet bitwise operations in Bird filters which is not in official code. If not, are there any plans to implement such an feature in Bird filters or should we try it to implement on our own and contribute this to the mailing list? For better understanding i include an example: We use the ospf_tag attribute as an group identifier. at the moment we have 4 groups. There are routers which could belong to more than one group. So we would like to combine the groups in any way. The most efficient way to reach this is an bitwise operation. -- Mit freundlichen Grüßen --------------------------------- Daniel Wendler
On 28.2.2014 13:27, Daniel Wendler wrote:
Hello List,
at the moment we try to implement an fine granulary filter mechanism in our Bird OSPF setup. We ask ourselfes if anyone has implementet bitwise operations in Bird filters which is not in official code. If not, are there any plans to implement such an feature in Bird filters or should we try it to implement on our own and contribute this to the mailing list?
This shouldn't be complicated to implement. Just let us know what kinds of operations you need and we will look at it. The most problematic part will be to choose appropriate syntax. :-) Ondrej
For better understanding i include an example:
We use the ospf_tag attribute as an group identifier. at the moment we have 4 groups. There are routers which could belong to more than one group. So we would like to combine the groups in any way. The most efficient way to reach this is an bitwise operation.
On Fri, Feb 28, 2014 at 01:27:35PM +0100, Daniel Wendler wrote:
Hello List,
at the moment we try to implement an fine granulary filter mechanism in our Bird OSPF setup. We ask ourselfes if anyone has implementet bitwise operations in Bird filters which is not in official code. If not, are there any plans to implement such an feature in Bird filters or should we try it to implement on our own and contribute this to the mailing list?
Hi Although adding bitfield operations is generally a good idea, your problem could be easily solved with current code and this filter function (a - number, b - value of the bit): function bittest(int a; int b) { return a/(2*b) != (a+b)/(2*b); } bittest(13,1) -> true bittest(13,2) -> false bittest(13,4) -> true bittest(13,8) -> true bittest(13,16) -> false -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hello Ondrej, thanks for your help. We have implementet your function and it works great. -- Mit freundlichen Grüßen --------------------------------- Daniel Wendler Am Freitag, 28. Februar 2014, 20:12:40 schrieb Ondrej Zajicek:
On Fri, Feb 28, 2014 at 01:27:35PM +0100, Daniel Wendler wrote:
Hello List,
at the moment we try to implement an fine granulary filter mechanism in our Bird OSPF setup. We ask ourselfes if anyone has implementet bitwise operations in Bird filters which is not in official code. If not, are there any plans to implement such an feature in Bird filters or should we try it to implement on our own and contribute this to the mailing list?
Hi
Although adding bitfield operations is generally a good idea, your problem could be easily solved with current code and this filter function (a - number, b - value of the bit):
function bittest(int a; int b) { return a/(2*b) != (a+b)/(2*b); }
bittest(13,1) -> true bittest(13,2) -> false bittest(13,4) -> true bittest(13,8) -> true bittest(13,16) -> false
participants (3)
-
Daniel Wendler -
Ondrej Filip -
Ondrej Zajicek