Discussion:
winsock: UDP-Rx without checksum
(too old to reply)
Ezmeralda
2007-06-26 17:58:09 UTC
Permalink
Hello,

I need to receive UDP Datagrams which do have no UDP-checksum, i. e.
UDP-checksum = 0x0000. My operating system is Windows 2000.
I tried with a normal socket


socket(PF_INET, SOCK_DGRAM, 0)


but obviously, I do not receive any datagram because of checksum.


Is it possible to disable checksum verification for RX-SOCK_DGRAM-
Sockets?
How?
Can you suggest a workaround if not?


Thanks!
Michael K. O'Neill
2007-06-27 18:21:42 UTC
Permalink
If it doesn't have a checksum, then it's not UDP. It might be some
different protocol (maybe self-defined or raw), but it's definitely not UDP.

Moreover, as Arkady has pointed out in another one of your posts, without
the checksum, all switches on the route to you will also drop the datagram.
Post by Ezmeralda
Hello,
I need to receive UDP Datagrams which do have no UDP-checksum, i. e.
UDP-checksum = 0x0000. My operating system is Windows 2000.
I tried with a normal socket
socket(PF_INET, SOCK_DGRAM, 0)
but obviously, I do not receive any datagram because of checksum.
Is it possible to disable checksum verification for RX-SOCK_DGRAM-
Sockets?
How?
Can you suggest a workaround if not?
Thanks!
Ezmeralda
2007-06-28 19:02:16 UTC
Permalink
Post by Michael K. O'Neill
Moreover, as Arkady has pointed out in another one of your posts, without
the checksum, all switches on the route to you will also drop the datagram.
I don`t think you are right:
- a switch is not allowed to interpret UDP-layer, it works on IP layer
- UDP does also allow not to use a checksum:
http://en.wikipedia.org/wiki/User_Datagram_Protocol
"If a checksum is not used it should be sent as zero (all 0's) as
zero indicates an unused checksum. "
Reason: if I do use this protocol only in a local LAN there is no
reason to use the checksum since
Ethernet does already provide the checksum.

On the other hand the C# socket interface seems to work also if no
checksum is used; and the
winsock interface provides some functionality to SEND udp messages
without checksum.

The question is: how can I receive UDP messages without checksum.
Michael K. O'Neill
2007-06-28 23:40:07 UTC
Permalink
Post by Ezmeralda
Post by Michael K. O'Neill
Moreover, as Arkady has pointed out in another one of your posts, without
the checksum, all switches on the route to you will also drop the datagram.
- a switch is not allowed to interpret UDP-layer, it works on IP layer
http://en.wikipedia.org/wiki/User_Datagram_Protocol
"If a checksum is not used it should be sent as zero (all 0's) as
zero indicates an unused checksum. "
Reason: if I do use this protocol only in a local LAN there is no
reason to use the checksum since
Ethernet does already provide the checksum.
On the other hand the C# socket interface seems to work also if no
checksum is used; and the
winsock interface provides some functionality to SEND udp messages
without checksum.
The question is: how can I receive UDP messages without checksum.
Live and learn; thanks for this. Per rfc-1122, "Requirements for Internet
Hosts -- Communication Layers", section 4.1.3.4 (UDP Checksums): "Unlike the
TCP checksum, the UDP checksum is optional; the value zero is transmitted in
the checksum field of a UDP header to indicate the absence of a checksum."
And compare section 4.2.2.7 (TCP Checksum): "Unlike the UDP checksum (see
Section 4.1.3.4), the TCP checksum is never optional. The sender MUST
generate it and the receiver MUST check it."

I am not certain of the solution to your question. You might try
setsockopt() with UDP_NOCHECKSUM, as described at "IPPROTO_UDP Socket
Options" at http://msdn2.microsoft.com/en-us/library/ms738603.aspx . This
might not work, however, since the option seems to pertain to sending of
datagrams, not their receipt.

Mike

Loading...