LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-06-2007, 05:48 AM   #1
estratos
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 85

Rep: Reputation: 15
Subnet mask erroneously stopping UDP packets


Hi all,

I'm developing an application that sends/receives broadcasted UDP packets to/from other machines on my LAN. This application runs on an uClinux ARM7 processor - I've tried to find the solution in the uClinux mail list with no luck. Now I post here my experiences just to see if this rings someone's bells.

The receiving side of my application is very similar to this example:
http://beej.us/guide/bgnet/examples/listener.c

In fact, this code gives the same results than my app.

And here I list my experiences...

----------------- SCENARIO 1 --------------------
Embedded box settings
IP address: 192.168.1.33
Def gateway: 192.168.1.1
Subnet mask: 255.255.255.0
(UDP packets broadcasted to 255.255.255.255)

Second machine (Win XP) settings
IP address: 192.168.1.16
Def gateway: 192.168.1.1
Subnet mask: 255.255.255.0
(UDP packets broadcasted to 192.168.1.255)

Packets are correctly sent and received by both applications (verified from Ethereal)
-------------------------------------------------
----------------- SCENARIO 2 --------------------
Embedded box settings (LESS EXCLUSIVE NETMASK !!)
IP address: 192.168.1.33
Def gateway: 192.168.1.1
Subnet mask: 255.0.0.0
(UDP packets broadcasted to 255.255.255.255)

Second machine settings (unchanged)
IP address: 192.168.1.16
Def gateway: 192.168.1.1
Subnet mask: 255.255.255.0
(UDP packets broadcasted to 192.168.1.255)

Packets are correctly sent by both applications (verified from Ethereal)
The second machine does receive the packets sent by the embedded box.

THE EMBEDDED BOX DOENS'T RECEIVE ANY PACKET FROM THE SECOND MACHINE !!

-------------------------------------------------

Please, any idea is welcome !

Thanks a lot,

Daniel.
 
Old 03-06-2007, 03:18 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
Are you sure the embedded machine does not receive the packets? You probably have a some kind of a LED. Check if it's blinking.

The problem seems to be quite simple. For netmask 255.0.0.0 and net 192. your address 192.168.1.255 is not a broadcast one. I think that the network stack realizes it's not the destination and silently drops your packets.
 
Old 03-07-2007, 02:54 AM   #3
estratos
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 85

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Mara
The problem seems to be quite simple. For netmask 255.0.0.0 and net 192. your address 192.168.1.255 is not a broadcast one. I think that the network stack realizes it's not the destination and silently drops your packets.
Thanks Mara!

This seems to be the problem. Manually setting the broadcast address to 192.168.1.255 (ifconfig eth0 broadcast 192.168.1.255) does make my application receive the udp packets, even with netmask=255.0.0.0. I get similar results on my Ubuntu machine, so, this behaviour seems to be linux-platform independant. Thus, the origin of this issue is how linux calculates the broadcast address from the subnet mask.

I'm going to post a message on the "Networking" board regarding this issue. I'm still concerned about this issue as many applications that are intended to communicate with my own app do send packets to different broadcast addresses (192.168.1.255, 192.255.255.255, 255.255.255.255).

On the other hand, Windows doesn't have this limitation...

Thanks again,

Daniel.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Subnet Mask with 1 IP. Ionized Linux - Networking 25 06-10-2007 12:20 AM
Subnet Mask jomyjose Linux - Networking 2 08-01-2006 09:19 AM
UDP: Short Packets: and UDP bad checksum: entries in dmesg minutes2memories Linux - Networking 2 02-26-2006 07:28 PM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM
Subnet mask mikeshn Linux - Networking 1 08-26-2002 01:19 PM


All times are GMT -5. The time now is 07:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration