Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/b642f1f23f7d
branches:  netbsd-9
changeset: 1002348:b642f1f23f7d
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 11 17:22:17 2021 +0000

description:
Pull up following revision(s) (requested by kardel in ticket #1332):

        sys/netinet6/in6_src.c: revision 1.88

PR kern/56348

MTU discovery fails with IPv6 sockets bound to IPv4 mapped address
pick up the IPv4 route for IPv4 mapped IPv6 address to get the correct
MTU and not any unrelated/inappropriate MTU from IPv6 routes. IPv4 mapped
IPv6 addresses are always handled by the IPv4 stack and MTU discovery
is solely handled with the IPv4 routing table.

diffstat:

 sys/netinet6/in6_src.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 5fa85afde8c0 -r b642f1f23f7d sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c    Wed Aug 11 17:19:01 2021 +0000
+++ b/sys/netinet6/in6_src.c    Wed Aug 11 17:22:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_src.c,v 1.85 2018/05/01 07:21:39 maxv Exp $        */
+/*     $NetBSD: in6_src.c,v 1.85.6.1 2021/08/11 17:22:17 martin 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.85 2018/05/01 07:21:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.85.6.1 2021/08/11 17:22:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -612,6 +612,7 @@
        struct rtentry *rt = NULL;
        union {
                struct sockaddr         dst;
+               struct sockaddr_in      dst4;
                struct sockaddr_in6     dst6;
        } u;
 
@@ -678,9 +679,17 @@
         * Use a cached route if it exists and is valid, else try to allocate
         * a new one.  Note that we should check the address family of the
         * cached destination, in case of sharing the cache with IPv4.
+        *
+        * for V4 mapped addresses we want to pick up the v4 route
+        * see PR kern/56348
         */
-       u.dst6 = *dstsock;
-       u.dst6.sin6_scope_id = 0;
+       if (IN6_IS_ADDR_V4MAPPED(&dstsock->sin6_addr)) {
+               in6_sin6_2_sin(&u.dst4, dstsock);
+       } else {
+               u.dst6 = *dstsock;
+               u.dst6.sin6_scope_id = 0;
+       }
+
        rt = rtcache_lookup1(*ro, &u.dst, 1);
 
        if (rt == NULL)



Home | Main Index | Thread Index | Old Index