Hi all,
I'm developing a WiFi Mesh software (based on EasyMesh) in Python3. But I'm facing an issue with the part of ieee1905 which needs to use "Neighbor Multicast".
I have a Layer 2 server (receives Ethernet frames) placed in br-lan, which receives all LAN traffic (from the eth switch and wifi). The device that i'm using for the tests is TP Link Archer C7v5.
In short, the Neighbor Multicast consist in check one flag in the payload, if the flag is not set, the multicast frames (to IEEE 1905 Multicast MAC Address) should not be relayed. So, what I've made:
------------------------1) Split all ethernet ports of the switch --------------------------------
And of course, move all the switching function to the Linux Kernel. I need this because I want to resolve in software the relay desition for each physical ethernet interface. If a neighbor multicast enters in one Eth interface, I need to inspect it in software first, and when I see that the flag is not set, I don't forward it to the rest. I've achieved that by using a VLAN per port and bridging all with brctl in br-lan:
Which in practice is made in /etc/config/network:
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
config interface 'lan'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '192.168.2.1'
option ifname 'eth0.1 eth0.2 eth0.3 eth0.4'
option delegate '0'
config interface 'wan'
option ifname 'eth0.5'
option proto 'dhcp'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '2 0t'
config switch_vlan
option device 'switch0'
option vlan '5'
option ports '1 0t'
option vid '5'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '3 0t'
option vid '2'
config switch_vlan
option device 'switch0'
option vlan '3'
option ports '4 0t'
option vid '3'
config switch_vlan
option device 'switch0'
option vlan '4'
option ports '5 0t'
option vid '4'
--------------------------------------2) Layer 2 Firewall Rules ---------------------------------
Using Ebtables , I can use configurations in order to forward every IEEE 1905 Multicast Packet to just br-lan interface (no to every physical interface in the bridge), where is my Layer 2 Server who will determine if the frame should be relayed or not.
For example i used:
-------------------------------------------THE PROBLEM ----------------------------------------
So... "what is the problem?" maybe are you asking. The problem is that... OK I can intercept and decide which frame should be relayed or not in software but... from which physical interface it has come?
I need to know if the frame has entered, for example, from eth0.3. So, if the flag is not set, I won't resend it, but I need to know from where it comes because I'm trying to make a table of Interface/Neighbors. But if the flag is set, I still need to know the physical interface, because I should retransmit the frame to every interface except the source, which at the moment I don't know how to detect (In the example, I should send it to eth0.1, eth0.2, eth0.4, wlan0 and wlan1).
In summary, my question is how can I detect from which physical interface has come a frame received in br-lan?
Any idea or suggetion is welcome.
Thanks in advance,
Pablo.