Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitwise operators not supported? #265

Open
oriolarcas opened this issue Jan 15, 2021 · 3 comments
Open

Bitwise operators not supported? #265

oriolarcas opened this issue Jan 15, 2021 · 3 comments

Comments

@oriolarcas
Copy link

oriolarcas commented Jan 15, 2021

I was trying to implement filters for IP network masks, and it seems that bitwise AND or OR operators are not supported. It came as a surprise, since I think this should be relatively straightforward to implement (new "&" and "|" bitwise operators) and would be a valuable feature.

Is it already implemented and I got it wrong? Otherwise, is there a workaround, besides doing it in userspace? I'd be happy to work on a PR if needed.

Great project, congratulations anyway!

@oriolarcas
Copy link
Author

I see that this was suggested in issue #52 (comment):

Would be nice if we could get bitwise operations in the filter language &, |, ^, ~, at minimum bitwise and would be super useful and far more efficient and and uniformly distributed.

@oriolarcas
Copy link
Author

In case somebody else is looking into this, finally I will be using the comparison operators "<=" and ">=" to check IP network ranges.

E.g., to check for 192.168.1.0/24, I will use the filter:

ip.DstAddr >= 192.168.1.0 and ip.DstAddr <= 192.168.1.255

@basil00
Copy link
Owner

basil00 commented Jan 25, 2021

No, bitwise or other operators are not supported, and I agree this would be a nice addition to the filter language. I can keep this open as a feature request, but it would take some effort to implement, so might not added for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants