Module Name: src
Committed By: maxv
Date: Sat Mar 17 10:21:09 UTC 2018
Modified Files:
src/sys/net/npf: npf_inet.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/npf/npf_inet.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/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.41 src/sys/net/npf/npf_inet.c:1.42
--- src/sys/net/npf/npf_inet.c:1.41 Tue Mar 13 16:23:40 2018
+++ src/sys/net/npf/npf_inet.c Sat Mar 17 10:21:09 2018
@@ -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 @@ npf_tcpsaw(const npf_cache_t *npc, tcp_s
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;
}