From owner-freebsd-net@FreeBSD.ORG Wed Oct 1 23:43:40 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E38AC14B for ; Wed, 1 Oct 2014 23:43:40 +0000 (UTC) Received: from oj.bangj.com (amt0.gin.ntt.net [129.250.11.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C068CF76 for ; Wed, 1 Oct 2014 23:43:40 +0000 (UTC) Received: from [10.149.128.203] (unknown [166.205.66.120]) by oj.bangj.com (Postfix) with ESMTPA id 5D0F11451; Wed, 1 Oct 2014 19:34:03 -0400 (EDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <2DA609BE-5704-463A-99BB-E64CB71931B2@bangj.com> X-Mailer: iPhone Mail (12A405) From: Tom Pusateri Subject: Re: UDP/IPv6 handling Date: Wed, 1 Oct 2014 19:34:04 -0400 To: Michael Tuexen Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2014 23:43:41 -0000 Lots of embedded devices (like Cisco IP Phones) send TFTP requests with 0 ch= ecksums.=20 Tom > On Oct 1, 2014, at 12:58 PM, Michael Tuexen wrote: >=20 > Dear all, >=20 > in udp6_input() we have the following code: >=20 > if (nxt =3D=3D IPPROTO_UDP && plen !=3D ulen) { > UDPSTAT_INC(udps_badlen); > goto badunlocked; > }=20 > /* > * Checksum extended UDP header and data. > */ > if (uh->uh_sum =3D=3D 0) { > if (ulen > plen || ulen < sizeof(struct udphdr)) { > UDPSTAT_INC(udps_nosum); > goto badunlocked; > } > } >=20 > I'm trying to understand the UDP code path... >=20 > So (ulen > plen) can't be true. I'm wondering why do we only check the ule= n is not too > short only in the case when the UDP checksum is zero. A zero checksum shou= ld also never happen. >=20 > I think we should check for ulen < sizeof(struct udphdr) in any case. >=20 > Opinions? >=20 > Best regards > Michael > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"