Open changtimwu opened 7 years ago
/* Never send packets back to the socket
* they originated from - MvS (miquels@drinkel.ow.org) */
Openwrt adds a new socket option called PACKET_RECV_TYPE
. Here is the patch
It's mainly for ead.
example usage of PACKET_RECV_TYPE
.
We make use of it.
int v=0;
v = PACKET_MASK_ANY & ~(1<<PACKET_OUTGOING) & ~(1 << PACKET_LOOPBACK);
setsockopt( raw_sock, SOL_PACKET, PACKET_RECV_TYPE, &v, sizeof(v));
Excellent! It works well.
Reference neither Raw Socket promiscuous mode not sniffing what I write nor C raw socket receive or sniff incoming packets only gives decent solution.