Source-Changes-HG archive

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

[src/trunk]: src/sys/net/npf Fix the IPv6 payload computation in npf_tcpsaw. ...



details:   https://anonhg.NetBSD.org/src/rev/2cabf1d7c087
branches:  trunk
changeset: 321469:2cabf1d7c087
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Mar 17 10:21:09 2018 +0000

description:
Fix the IPv6 payload computation in npf_tcpsaw. It was incorrect, and this
caused the "return-rst" rules to send back an RST with the wrong ACK when
the received SYN had an IPv6 option.

diffstat:

 sys/net/npf/npf_inet.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 7908e513f819 -r 2cabf1d7c087 sys/net/npf/npf_inet.c
--- a/sys/net/npf/npf_inet.c    Sat Mar 17 09:45:44 2018 +0000
+++ b/sys/net/npf/npf_inet.c    Sat Mar 17 10:21:09 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $       */
+/*     $NetBSD: npf_inet.c,v 1.42 2018/03/17 10:21:09 maxv Exp $       */
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.42 2018/03/17 10:21:09 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -215,7 +215,8 @@
                return ntohs(ip->ip_len) - npc->npc_hlen - thlen;
        } else if (npf_iscached(npc, NPC_IP6)) {
                const struct ip6_hdr *ip6 = npc->npc_ip.v6;
-               return ntohs(ip6->ip6_plen) - thlen;
+               return ntohs(ip6->ip6_plen) -
+                   (npc->npc_hlen - sizeof(*ip6)) - thlen;
        }
        return 0;
 }



Home | Main Index | Thread Index | Old Index