Using sources from this article RAW_SOCKET to forge UDP packets I am generating packets from other host to own eth0 ip address, as example, 192.168.10.1 –> 192.168.10.131.
But tcpdump shows, that packets are arriving into lo, not eth0…
on lo –
10:10:18.332284 IP (tos 0x0, ttl 64, id 768, offset 0, flags [DF], proto UDP (17), length 71)
192.168.10.1.57961 > 192.168.10.131.12001: [udp sum ok] UDP, length 43
and on eth0 is silence.
How to change the code, to make packets arrive into eth0?
direct link to C source file
As I see, you have to use tcp functions instead of udp
For UDP you can set the optname to SO_BINDTODEVICE