Discussion:
recvfrom, source address 0.0.0.0
(too old to reply)
a***@gmail.com
2006-10-19 23:24:54 UTC
Permalink
Hi,

Is there a way I can pick UDP packets(data) through recvfrom call on a
UDP socket, when the source IP address is 0.0.0.0 in the UDP packet.
Right now, those packets are coming to my system(seen on tcpdump), but
somehow not reaching the application.

Thanks in advance.
- Angshuman
Barry Margolin
2006-10-20 01:54:56 UTC
Permalink
Post by a***@gmail.com
Hi,
Is there a way I can pick UDP packets(data) through recvfrom call on a
UDP socket, when the source IP address is 0.0.0.0 in the UDP packet.
Right now, those packets are coming to my system(seen on tcpdump), but
somehow not reaching the application.
Except in special cases like a DHCP client sending a broadcast before it
has configured its IP address, 0.0.0.0 is not a valid source address.
And RFC 1122 says that hosts must discard packets with invalid source
addresses.

To get around this, I think you may need to use a raw socket.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Pascal Hambourg
2006-10-20 11:01:55 UTC
Permalink
Hello,
Post by Barry Margolin
Post by a***@gmail.com
Is there a way I can pick UDP packets(data) through recvfrom call on a
UDP socket, when the source IP address is 0.0.0.0 in the UDP packet.
Right now, those packets are coming to my system(seen on tcpdump), but
somehow not reaching the application.
Except in special cases like a DHCP client sending a broadcast before it
has configured its IP address, 0.0.0.0 is not a valid source address.
And RFC 1122 says that hosts must discard packets with invalid source
addresses.
To get around this, I think you may need to use a raw socket.
That seems to be what the DHCP server dhcpd does.

# netstat --inet -nlp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:67 0.0.0.0:* 629/dhcpd
raw 0 0 0.0.0.0:1 0.0.0.0:* 7 629/dhcpd
Continue reading on narkive:
Search results for 'recvfrom, source address 0.0.0.0' (Questions and Answers)
5
replies
What is UDP? (in computer network )?
started 2008-01-04 00:56:19 UTC
programming & design
Loading...