-
I am developing an application which utilizes raw packet sockets for a range of pseudo-multicast addresses, but also need to support standard UDP ports using different UPD destination ports. To support raw packet sockets for the multicast addresses, where I need to retain L2/L3 headers, I am using a raw packet socket. This raw socket provides me the host packet with everything intact, so I can use that read opportunity to dispatch the UDP packet also on to specific handlers for the individual UDP destination ports, simply by removing the UDP header itself. Currently when host data is driven into the raw socket interface will not find a UDP socket bound for 2 of the 3 UDP destination ports, and therefore will send an ICMP message to the data originator. The call stack for this is shown below. I thought I could solve this by creating 2 additional UDP sockets, each bound to the different UDP destination ports, or perhaps one UPD socket bound to any port. But this approach might introduce some inefficiencies, since I already am receiving the full packet. Is there a more efficient way of suppressing the Zephyr to host ICMP for the unresolved driven UDP destination ports than what I have described? I did add a couple of UDP sockets bounds to the sent destination port. However, this resulted in leaks, perhaps requiring each of these sockets having a reader rather than just being passive listeners? Since I already have the packet as L2, it is not technically necessary that I read them at the UDP socket level, but that is a viable option. Since I want UDP support for a single port (1 of 3), I do not want to simply remove UDP support for the kernel build. The callstack for the ICMP error response is as follows:
Implementation is raw packet sockets using zsock_select() for multiplexed i/o. Kernel configuration is as follows:
The iperf command driving data into the wired interface is as follows: iperf -c 192.0.1.1 -u -i1 -b5M -l188 -p49169 -t1 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was able to solve this problem by not just having a BSD style UDP socket bound to specific ports, but I also needed to have the data read using this socket rather than just obtaining the same data, with L2 header intact at the raw socket level. |
Beta Was this translation helpful? Give feedback.
I was able to solve this problem by not just having a BSD style UDP socket bound to specific ports, but I also needed to have the data read using this socket rather than just obtaining the same data, with L2 header intact at the raw socket level.