summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRichard Procter <procter@cvs.openbsd.org>2019-02-08 20:28:55 +0000
committerRichard Procter <procter@cvs.openbsd.org>2019-02-08 20:28:55 +0000
commitdc851c4b755a84e7682e9aa102263375b9914427 (patch)
tree8392e6b32128d30c08ae296cbdab7075fb4c2402 /sys
parent50b487d01e495416f3b24c7fe9812d576bb0f340 (diff)
fix ipv4 checksum fixup; this trick requires an accumulator of exactly twice the checksum's width
ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/netmpls/mpls_input.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 4dac4616ed4..371376de8b7 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.74 2019/01/29 23:36:35 dlg Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.75 2019/02/08 20:28:54 procter Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -303,7 +303,8 @@ struct mbuf *
mpls_ip_adjttl(struct mbuf *m, u_int8_t ttl)
{
struct ip *ip;
- uint16_t old, new, x;
+ uint16_t old, new;
+ uint32_t x;
if (m->m_len < sizeof(*ip)) {
m = m_pullup(m, sizeof(*ip));
@@ -317,6 +318,7 @@ mpls_ip_adjttl(struct mbuf *m, u_int8_t ttl)
x = ip->ip_sum + old - new;
ip->ip_ttl = ttl;
+ /* see pf_cksum_fixup() */
ip->ip_sum = (x) + (x >> 16);
return (m);