Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Oct 2014 22:51:06 -0500
From:      Bryan Venteicher <bryanv@daemoninthecloset.org>
To:        Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: UDP/IPv6 handling
Message-ID:  <CAMo0n6Q56yvHYp8XUG499gkkxL0=QRdTVDvph9jA=kNL4%2BS-1A@mail.gmail.com>
In-Reply-To: <B30E0A41-51B0-442C-9476-0D9E99C0D37C@lurchi.franken.de>
References:  <B30E0A41-51B0-442C-9476-0D9E99C0D37C@lurchi.franken.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 1, 2014 at 11:58 AM, Michael Tuexen <
Michael.Tuexen@lurchi.franken.de> wrote:

> Dear all,
>
> in udp6_input() we have the following code:
>
>         if (nxt =3D=3D IPPROTO_UDP && plen !=3D ulen) {
>                 UDPSTAT_INC(udps_badlen);
>                 goto badunlocked;
>         }
>         /*
>          * 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;
>                 }
>         }
>
> I'm trying to understand the UDP code path...
>
>
=E2=80=8BI too was recently confused by this code. =E2=80=8BI pointed out o=
ne issue to
kevlo@ recently, but it still kind of seemed like the UDP-Lite was
mismerged to IPv6.

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.
>
>
=E2=80=8BI hope to have a patch for =E2=80=8BRFC6935 [1] soon so a zero che=
cksum may be
allowed if the inp/udpcb is configured for it.

I think we should check for ulen < sizeof(struct udphdr) in any case.
>
>
=E2=80=8BI think previously, the checks in ip6_input(), IP6_EXTHDR_CHECK(),=
 and
plen =3D=3D ulen made this unnecessary. I think we'd want to do it for UDP-=
Lite
if ulen was not initially zero.

=E2=80=8B[1]  - http://tools.ietf.org/html/rfc6935=E2=80=8B


> Opinions?
>
> 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"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMo0n6Q56yvHYp8XUG499gkkxL0=QRdTVDvph9jA=kNL4%2BS-1A>