summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2000-04-12 18:05:47 +0000
committerangelos <angelos@openbsd.org>2000-04-12 18:05:47 +0000
commit5cff1e9eb1c38a73f07d97870c11d771f906abc6 (patch)
tree0c3c14b0fd7c04144745d35d98282e24d5063ed7
parentRemove all arguments to the .Os macro so that all of 2.7's man pages will (diff)
downloadwireguard-openbsd-5cff1e9eb1c38a73f07d97870c11d771f906abc6.tar.xz
wireguard-openbsd-5cff1e9eb1c38a73f07d97870c11d771f906abc6.zip
Fix checksum for outgoing etherip/ipip packets from enc interfaces.
-rw-r--r--sys/net/if_enc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index 9f7edda7e57..329a342d690 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_enc.c,v 1.27 2000/04/10 07:34:53 angelos Exp $ */
+/* $OpenBSD: if_enc.c,v 1.28 2000/04/12 18:05:47 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -261,6 +261,17 @@ struct ifnet *ifp;
mp = NULL;
}
+#ifdef INET
+ /* Fix header checksum for IPv4 */
+ if (tdb->tdb_dst.sa.sa_family == AF_INET)
+ {
+ struct ip *ip;
+
+ ip = mtod(m, struct ip *);
+ ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
+ }
+#endif
+
protoflag = tdb->tdb_dst.sa.sa_family;
/* IPsec packet processing -- skip encapsulation */