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 and multiple vcan #483

Open
pompushko opened this issue Dec 11, 2023 · 3 comments
Open

cangw and multiple vcan #483

pompushko opened this issue Dec 11, 2023 · 3 comments

Comments

@pompushko
Copy link

Hello.

I have a strange issue with cangw and 2 virtual CANs.

cat /etc/network/interfaces.d/vcan0

auto vcan0
iface vcan0 inet manual
        pre-up /sbin/ip link add dev $IFACE type vcan
        pre-up /sbin/ip link set dev $IFACE mtu 16
        up /sbin/ifconfig $IFACE up mtu 16
        down /sbin/ifconfig $IFACE down
        post-up /usr/bin/cangw -A -s vcan0 -d can0 -e -f 98DA00F1:DFFF00FF
        post-up /usr/bin/cangw -A -s can0 -d vcan0 -e -f 98DAF100:DFFFFF00

cat /etc/network/interfaces.d/vcan1

auto vcan1
iface vcan1 inet manual
        pre-up /sbin/ip link add dev $IFACE type vcan
        pre-up /sbin/ip link set dev $IFACE mtu 16
        up /sbin/ifconfig $IFACE up mtu 16
        down /sbin/ifconfig $IFACE down
        post-up /usr/bin/cangw -A -s vcan1 -d can1 -e -f 98DA00F1:DFFF00FF
        post-up /usr/bin/cangw -A -s can1 -d vcan1 -e -f 98DAF100:DFFFFF00

My cangw rules works strange:

cangw -A -s can1 -d vcan1 -e -f 98DAF100:DFFFFF00 # 0 handled 0 dropped 0 deleted
cangw -A -s vcan1 -d can1 -e -f 98DA00F1:DFFF00FF # 12 handled 0 dropped 0 deleted           <=
cangw -A -s can0 -d vcan0 -e -f 98DAF100:DFFFFF00 # 18 handled 0 dropped 0 deleted           <=
cangw -A -s vcan0 -d can0 -e -f 98DA00F1:DFFF00FF # 0 handled 0 dropped 0 deleted

Some of mine packets go to second virtual interface, but should go to first one.
Very strange...

Or my rules are bad?

@hartkopp
Copy link
Member

Nothing looks wrong here.
You get traffic from can0 that is routed to vcan0 and you get traffic from vcan1 that is routed to can1.
There is no connection between *can0 and *can1 - or is there some userspace application for this?

@pompushko
Copy link
Author

Yep.... no connection. Even different speed :D

@hartkopp
Copy link
Member

So what is your problem then?
There are different filters too.

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