summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-10-18 11:29:27 +0000
committerbluhm <bluhm@openbsd.org>2016-10-18 11:29:27 +0000
commitf1b0ae9324e527b0bbf479fd0e53e13f090ac9d2 (patch)
treeef53b29ef3ff9379d6da8b99e72221204aca0d7e
parentThe checksum of a ICMP "need to frag" packet for TCP was wrong when (diff)
downloadwireguard-openbsd-f1b0ae9324e527b0bbf479fd0e53e13f090ac9d2.tar.xz
wireguard-openbsd-f1b0ae9324e527b0bbf479fd0e53e13f090ac9d2.zip
The variable dlen is always positive and d may be negative. So
declare both with the correct sign in pf_change_icmp_af(). OK henning@
-rw-r--r--sys/net/pf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index aa7b9f33b8a..d3b313c1305 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.990 2016/10/18 11:20:42 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.991 2016/10/18 11:29:27 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -2340,7 +2340,8 @@ pf_change_icmp_af(struct mbuf *m, int ipoff2, struct pf_pdesc *pd,
struct mbuf *n = NULL;
struct ip *ip4;
struct ip6_hdr *ip6;
- u_int hlen, ohlen, d;
+ u_int hlen, ohlen, dlen;
+ int d;
if (af == naf || (af != AF_INET && af != AF_INET6) ||
(naf != AF_INET && naf != AF_INET6))
@@ -2417,7 +2418,7 @@ pf_change_icmp_af(struct mbuf *m, int ipoff2, struct pf_pdesc *pd,
if (pd->proto == IPPROTO_ICMPV6) {
/* fixup pseudo-header */
- int dlen = pd->tot_len - pd->off;
+ dlen = pd->tot_len - pd->off;
pf_cksum_fixup(pd->pcksum,
htons(dlen), htons(dlen + d), pd->proto);
}