LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Dropped UDP packets (https://www.linuxquestions.org/questions/linux-networking-3/dropped-udp-packets-4175502834/)

silent90 04-24-2014 07:42 AM

Dropped UDP packets
 
Hello.

Some time ago I have build custom devices with ethernet controller. The devices are configured (including IP address) by UDP packets; discovery of connected devices looks like this:

-Server (192.168.1.1) sends broadcast UDP packet (192.168.1.255) from src port 56781 to dst port 56782.
-Device responds with UDP packet from server's IP (192.168.1.1) port 56782 to same ip 192.168.1.1, port 56781 with some information in UDP data field.

This allows me to communicate with devices without assigned IP with simple UDP instead using raw sockets. The method works fine on Windows (incoming packets from "my ip" and different MAC are not suspicious and not dropped), but i ran into some problems on Linux. It worked also on Raspberry Pi (Raspbian (debian)), but it does not work on Ubuntu 12.04 (VirtualBox). which is also Debian-based.
I can see incoming UDP packet in Wireshark, bot the application is not receiving anything. I have tried to connect USB Ethernet adapter to eliminate buggy VM Network driver - no luck.

Are there any protection against IP spoofing, MAC restriction (private MAC) or anything other i should know about and disable?

nikmit 04-24-2014 08:51 AM

If you enable martian packet logging you will probably start seeing the drops, and if you disable rp_filter you might stop dropping them.
I have struggled similarly before, will be nice to see what you come up with :)

silent90 04-24-2014 10:25 AM

Thanks for the reply!

I have enabled marian logging and those packed are classified as martian indeed.

from dmesg:
Code:

[15183.790052] martian source 192.168.1.102 from 192.168.1.102, on dev eth5
...

I have tried to disable rp_filter:
Code:

echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
Still no luck - packets are logged and dropped. Is there any way to disable martian packet dropping (or at least from the same IP as own address)?

silent90 04-24-2014 12:03 PM

I got it!

Linux kernel drops incoming packets which source address match the local interface address. It can be changed by enabling accept_local:
Code:

echo 1 > /proc/sys/net/ipv4/conf/all/accept_local
Thanks for the hint, it helped me a lot.


All times are GMT -5. The time now is 07:23 PM.