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

CANGW: Getting Around Multiple Inverted Filters #471

Open
dlackner opened this issue Nov 22, 2023 · 1 comment
Open

CANGW: Getting Around Multiple Inverted Filters #471

dlackner opened this issue Nov 22, 2023 · 1 comment

Comments

@dlackner
Copy link

Hello (I assume hartkopp)!

I saw your comment to s177oke77 referenced here in regrades to how creating two filter jobs with inverted filters will always let something pass. However, creating positive filters for my application would be pretty big challenge. There is a lot of traffic coming over the can bus and I have a use case where I want to prevent can messages intended for two different devices to be filtered out.

My Question:
In candump land this is what I am trying to accomplish

candump vcan3,91200000~DFE00000,82048000~DFFFF000,j

In cangw land this is what I would hope to use, but it will always lets something pass:

cangw -A -s can0 -d can0New -e -f 91200000~DFE00000,82048000~FFFFF000

Is there an alternative way to write this expression? How would one go about filtering out multiple canIDs on a line where there positive canids (the ones we want to continue on their merry way) are not known/can change.

Happy Thanksgiving!

Thank You,
David

@dlackner dlackner changed the title Getting Around Multiple Inverted Filters CANGW: Getting Around Multiple Inverted Filters Nov 22, 2023
@hartkopp
Copy link
Member

Hi David,

the cangw kernel module only supports ONE filter that may be inverse.
The can_raw sockets support MULTIPLE filters that can be passed to the kernel with the CAN_RAW_FILTER sockopt syscall.

The can_raw socket implements a tricky per_cpu mechanism ...
torvalds/linux@514ac99
torvalds/linux@a5581ef
that might be implemented into gw.c to implement logic AND filters too.
But with the current implementation you need to express your filter requirements with (independent) multiple positive filters. So there is some hex filter calculating magic to do ...

Best regards,
Oliver

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