Module Name: src Committed By: christos Date: Sun Aug 27 12:34:21 UTC 2017
Modified Files: src/sys/netinet6: in6_src.c Log Message: PR/52382: BERTRAND Joel: Fix mapped IPv4 source selection; this got broken in the last code refactoring. in6_selectif failing is not fatal. XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/netinet6/in6_src.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/in6_src.c diff -u src/sys/netinet6/in6_src.c:1.79 src/sys/netinet6/in6_src.c:1.80 --- src/sys/netinet6/in6_src.c:1.79 Thu Feb 16 22:57:17 2017 +++ src/sys/netinet6/in6_src.c Sun Aug 27 08:34:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $ */ +/* $NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $ */ /* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */ /* @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -461,7 +461,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct in6_ifaddr *ia = NULL; struct in6_pktinfo *pi = NULL; u_int32_t odstzone; - int error; + int error = 0, iferror; #if defined(MIP6) && NMIP > 0 u_int8_t ip6po_usecoa = 0; #endif /* MIP6 && NMIP > 0 */ @@ -484,7 +484,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso * to this function (e.g., for identifying the appropriate scope zone * ID). */ - error = in6_selectif(dstsock, opts, mopts, ro, &ifp, PSREF); + iferror = in6_selectif(dstsock, opts, mopts, ro, &ifp, PSREF); if (ifpp != NULL) *ifpp = ifp; @@ -549,8 +549,10 @@ in6_selectsrc(struct sockaddr_in6 *dstso * The outgoing interface is crucial in the general selection procedure * below. If it is not known at this point, we fail. */ - if (ifp == NULL) + if (ifp == NULL) { + error = iferror; goto exit; + } /* * If the address is not yet determined, choose the best one based on