RTnet -- receive broadcast frame at the local machine
Dnia Środa, 2 Marca 2016 14:07 Gilles Chanteperdrix <[email protected]> napisał(a)
Quoted 17 lines · Mariusz Janiak
Quoted 8 lines
Quoted 2 lines
From what I understand from this post, it is not easy to fix, as it requires duplicating packets. So, patch welcome.
Ok, we went back to the original question, could someone point the place that has to be modified. I have played a little bit with the RTnet stack recently, but this task require far better understanding of the stack. Maybe someone more advanced can give some guidelines.
It is not that complicated. The udp send function (
rt_udp_sendmsg) is inudp.c, it callsrt_ip_route_output(found inroute.c) to find the output route, thanrt_ip_build_xmit(found inip_output.c) to build the packet and send in on the device.rt_ip_build_xmitcallsrt_eth_headerto build the ethernet header (found ineth.c), thenrtdev_xmit(found indev.c) to send the packet.
Quoted 11 lines
So you can do this either at the IP level in
rt_ip_build_xmit, or at the ethernet level inrtdev_xmit. What you need to do is that when the destination is broadcast (there should be a macro to test that an IP address is broadcast if you want to do it at IP level, and the mac address for broadcast is just ff:ff:ff:ff:ff:ff if you want to do it at ethernet level) you need to duplicate the packet, and either trigger a receive on the same device, or send the packet on the loopback device. If you go the ethernet route, you will have to use a per-device callback to test if the destination is broadcast, asrtdev_xmitis supposed to not be specific to ethernet, like is done with thehard_headerandstart_xmitcallbacks.
Thank you Gilles, I see it more clearly now. I think I will go the ethernet route. I will back with patch soon.
Regards,
Marisz
Quoted 6 lines
Hope this helps.
Regards.Signature · 2 lines
Gilles. https://click-hack.org