diff options
author | 2019-02-08 20:28:54 +0000 | |
---|---|---|
committer | 2019-02-08 20:28:54 +0000 | |
commit | f1859ff18d5ac5ff1caadad2228817af0ce41d39 (patch) | |
tree | 51517dd9b025e207af7cc93159a5bbd2d3845cb7 | |
parent | Fix kernel info leak in routing message. (diff) | |
download | wireguard-openbsd-f1859ff18d5ac5ff1caadad2228817af0ce41d39.tar.xz wireguard-openbsd-f1859ff18d5ac5ff1caadad2228817af0ce41d39.zip |
fix ipv4 checksum fixup; this trick requires an accumulator of exactly twice the checksum's width
ok dlg@
-rw-r--r-- | sys/netmpls/mpls_input.c | 6 |
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); |