UDP/IPv6 handling

Michael Tuexen Michael.Tuexen at lurchi.franken.de
Thu Oct 2 07:23:10 UTC 2014


On 02 Oct 2014, at 01:34, Tom Pusateri <pusateri at bangj.com> wrote:

> Lots of embedded devices (like Cisco IP Phones) send TFTP requests with 0 checksums. 
I guess this uses UDP/IPv4, where FreeBSD supports UDP with zero checksum.
For UDP/IPv6 this doesn't work. Right after the cited code, the checksum is always
checked...

Best regards
Michael
> 
> Tom
> 
> 
> 
>> On Oct 1, 2014, at 12:58 PM, Michael Tuexen <Michael.Tuexen at lurchi.franken.de> wrote:
>> 
>> Dear all,
>> 
>> in udp6_input() we have the following code:
>> 
>>   if (nxt == IPPROTO_UDP && plen != ulen) {
>>       UDPSTAT_INC(udps_badlen);
>>       goto badunlocked;
>>   } 
>>   /*
>>    * Checksum extended UDP header and data.
>>    */
>>   if (uh->uh_sum == 0) {
>>       if (ulen > plen || ulen < sizeof(struct udphdr)) {
>>           UDPSTAT_INC(udps_nosum);
>>           goto badunlocked;
>>       }
>>   }
>> 
>> I'm trying to understand the UDP code path...
>> 
>> So (ulen > plen) can't be true. I'm wondering why do we only check the ulen is not too
>> short only in the case when the UDP checksum is zero. A zero checksum should also never happen.
>> 
>> I think we should check for ulen < sizeof(struct udphdr) in any case.
>> 
>> Opinions?
>> 
>> Best regards
>> Michael
>> _______________________________________________
>> freebsd-net at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-net
>> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> 



More information about the freebsd-net mailing list