dhcpd will discard DHCP request when checksum value of packet is 0xffff.
Joerg Mayer
jmayer at loplof.de
Wed Aug 24 13:51:31 UTC 2011
On Wed, Aug 24, 2011 at 04:54:59PM +0900, Yoshihiro takahashi wrote:
> dhcpd will discard DHCP request when checksum value of packet is 0xffff.
That's not completely correct: It will discard the packet in case the calculated
checksum would be 0.
> 0xffff for checksum value is equivalent to 0x0000.
> In 0xffff case, is the packet treated as error?
>
> RFC768
> ------
> If the computed checksum is zero, it is transmitted as all ones
> ------
>
> dhcp-discover did not work when checksum of packet is 0xffff.
> ----
> 52 0.853890 172.18.76.162 172.18.76.161 DHCP DHCP Request - Transaction ID 0x2862
> Frame 52 (1514 bytes on wire, 1514 bytes captured)
> Ethernet II, Src: ********* (00:40:66:43:99:b2), Dst: ******** (00:07:32:16:47:b0)
> Internet Protocol, Src: 172.18.76.162 (172.18.76.162), Dst: 172.18.76.161 (172.18.76.161)
> User Datagram Protocol, Src Port: bootps (67), Dst Port: bootps (67)
> Source port: bootps (67)
> Destination port: bootps (67)
> Length: 1480
> Checksum: 0xffff [validation disabled]
Validation disabled means that tshark has been instructed to not check wether the
transmitted checksum is OK.
> Bootstrap Protocol
> ----
>
>
> Best regards,
>
> diff -aurp dhcp-4.2.2.orig/common/packet.c dhcp-4.2.2/common/packet.c
> --- dhcp-4.2.2.orig/common/packet.c 2011-08-24 13:44:50.251979028 +0900
> +++ dhcp-4.2.2/common/packet.c 2011-08-24 14:10:46.688060536 +0900
> @@ -322,7 +322,10 @@ decode_udp_ip_header(struct interface_in
> 8, IPPROTO_UDP + ulen))));
It would be easier and clrearer to add in this place:
if (sum == 0) sum = 0xffff;
>
> udp_packets_seen++;
> - if (usum && usum != sum) {
> + /* RFC768
> + * If the computed checksum is zero, it is transmitted as all ones
> + */
> + if (usum && usum != sum && !(usum == 0xffff && sum == 0)) {
> udp_packets_bad_checksum++;
> if (udp_packets_seen > 4 &&
> (udp_packets_seen / udp_packets_bad_checksum) < 2) {
Nice find.
Ciao
Joerg
--
Joerg Mayer <jmayer at loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
More information about the dhcp-hackers
mailing list