I am listening to multicast data from an external source.
When my application runs without Onload, everything is fine. However, when I run under Onload I receive every packet twice.
This is how I join the multicast group:
struct ip_mreq mreq;
bzero(&mreq,sizeof(mreq));
mreq.imr_multiaddr.s_addr = inet_addr("233.1.2.3");
mreq.imr_interface.s_addr = inet_addr("192.1.2.3");
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof(mreq)) < 0)
...
How can I run under Onload without receiving every packet twice?
The most likely reason for a packet being seen twice in the application is that it is arriving twice to the host, either twice on the same interface or on different interfaces. Try running a packet capture (
tcpdumporonload_tcpdump) to confirm if this is the case.This behaviour is different from the kernel where packets arriving on the "wrong" interface are dropped. Onload will typically install a filter on all accelerated interfaces to capture traffic and not just the one specified by the application.