Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/netinet6 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/ca8d171607d1
branches:  netbsd-8
changeset: 445585:ca8d171607d1
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 04 11:14:09 2018 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #1079):

        sys/netinet6/udp6_usrreq.c: revision 1.142
        applied to udp6_output.c (refactured in HEAD)

Fix error path in ip6 source address selection.

in6_selectsrc previously returned a pointer to an ipv6 address,
the pointer was NULL in case of an error and is checked later
instead of the also returned error code. When in6_selectsrc was
changed to store the address into a buffer, the error code
was still ignored, but the buffer pointer was never set to NULL.

As a result send() to an ipv6 address on a system that isn't
configured for ipv6 no longer returns the expected EADDRAVAIL
but fails later in ip6_output with EOPNOTSUPP when trying to
send from an unspecified address. The wrong error code caused
BIND to log the unexpected errors.

diffstat:

 sys/netinet6/udp6_output.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 4499d48c3765 -r ca8d171607d1 sys/netinet6/udp6_output.c
--- a/sys/netinet6/udp6_output.c        Sun Nov 04 11:08:10 2018 +0000
+++ b/sys/netinet6/udp6_output.c        Sun Nov 04 11:14:09 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_output.c,v 1.55 2017/03/03 07:13:06 ozaki-r Exp $ */
+/*     $NetBSD: udp6_output.c,v 1.55.6.1 2018/11/04 11:14:09 martin Exp $      */
 /*     $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $    */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.55 2017/03/03 07:13:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.55.6.1 2018/11/04 11:14:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -233,7 +233,10 @@
                            in6p->in6p_moptions,
                            &in6p->in6p_route,
                            &in6p->in6p_laddr, &oifp, &psref, &_laddr);
-                       /* XXX need error check? */
+                       if (error)
+                               laddr = NULL;
+                       else
+                               laddr = &_laddr;
                        if (oifp && scope_ambiguous &&
                            (error = in6_setscope(&sin6->sin6_addr,
                            oifp, NULL))) {
@@ -243,7 +246,6 @@
                        }
                        if_put(oifp, &psref);
                        curlwp_bindx(bound);
-                       laddr = &_laddr;
                } else {
                        /*
                         * XXX: freebsd[34] does not have in_selectsrc, but



Home | Main Index | Thread Index | Old Index