Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/ipf/netinet Fix ipf failing to sent TCP RST...



details:   https://anonhg.NetBSD.org/src/rev/cca21821f804
branches:  trunk
changeset: 355238:cca21821f804
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jul 20 18:12:51 2017 +0000

description:
Fix ipf failing to sent TCP RST's on link-local interfaces by stuffing
the scope KAME style before calling the routing routines instead of after.
>From Edgar Fuss.

diffstat:

 sys/external/bsd/ipf/netinet/ip_fil_netbsd.c |  19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diffs (54 lines):

diff -r ba42a0c66596 -r cca21821f804 sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
--- a/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c      Thu Jul 20 10:00:25 2017 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c      Thu Jul 20 18:12:51 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_fil_netbsd.c,v 1.23 2017/05/12 08:03:26 christos Exp $      */
+/*     $NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $      */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.23 2017/05/12 08:03:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c     2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -1420,6 +1420,9 @@
                sockaddr_in6_init(&u.dst6, &fdp->fd_ip6.in6, 0, 0, 0);
        else
                sockaddr_in6_init(&u.dst6, &fin->fin_fi.fi_dst.in6, 0, 0, 0);
+       /* KAME */
+       if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
+               u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
        dst = &u.dst;
        rtcache_setdst(ro, dst);
 
@@ -1431,6 +1434,9 @@
        dst6->sin6_family = AF_INET6;
        dst6->sin6_len = sizeof(struct sockaddr_in6);
        dst6->sin6_addr = fin->fin_fi.fi_dst.in6;
+       /* KAME */
+       if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
+               dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
 
        if (fdp != NULL) {
                if (IP6_NOTZERO(&fdp->fd_ip6))
@@ -1449,15 +1455,6 @@
                goto bad;
        }
 
-       /* KAME */
-# if __NetBSD_Version__ >= 499001100
-       if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
-               u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# else
-       if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
-               dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# endif
-
        {
 # if (__NetBSD_Version__ >= 106010000) && !defined(IN6_LINKMTU)
                struct in6_ifextra *ife;



Home | Main Index | Thread Index | Old Index