LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-24-2014, 07:42 AM   #1
silent90
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Rep: Reputation: Disabled
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?

Last edited by silent90; 04-24-2014 at 08:30 AM.
 
Old 04-24-2014, 08:51 AM   #2
nikmit
Member
 
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178

Rep: Reputation: 34
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
 
1 members found this post helpful.
Old 04-24-2014, 10:25 AM   #3
silent90
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
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)?
 
Old 04-24-2014, 12:03 PM   #4
silent90
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Udp packets dropped while sending in RHEL4 chinoy Linux - Networking 1 08-21-2008 10:07 PM
UDP: Short Packets: and UDP bad checksum: entries in dmesg minutes2memories Linux - Networking 2 02-26-2006 07:28 PM
too much dropped packets...Hi.. alaios Linux - Networking 2 02-10-2005 04:49 AM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration