summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-12-10 06:40:22 +0000
committerdlg <dlg@openbsd.org>2020-12-10 06:40:22 +0000
commit22c79bfc5a343ef1dfe575157d8cd8a0dc743910 (patch)
tree9f9f230a05d7e3fc8f8c77431471de0ab298342d
parentremove timespec_to_jiffies() which no longer exists in linux (diff)
downloadwireguard-openbsd-22c79bfc5a343ef1dfe575157d8cd8a0dc743910.tar.xz
wireguard-openbsd-22c79bfc5a343ef1dfe575157d8cd8a0dc743910.zip
when setting a flowid, set the M_FLOWID csum_flags bit too.
this "fixes" TCP going over an interface with fq codel enabled. the way the codel code classifies a packet without a flowid set is to randomly assign it to a bucket. this in turn means that packets will get reordered, and tcp hates that. sthen was able to find a test case and narrow down at which time the problem appeared, helped greatly. tested by sthen@ and millert@ ok sashan@ jmatthew@
-rw-r--r--sys/net/pf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 4ac4cc45f78..f65b77aa487 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.1095 2020/12/07 08:29:41 sashan Exp $ */
+/* $OpenBSD: pf.c,v 1.1096 2020/12/10 06:40:22 dlg Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -7183,8 +7183,10 @@ done:
pf_state_key_link_inpcb(s->key[PF_SK_STACK],
pd.m->m_pkthdr.pf.inp);
- if (s && (pd.m->m_pkthdr.csum_flags & M_FLOWID) == 0)
+ if (s != NULL && !ISSET(pd.m->m_pkthdr.csum_flags, M_FLOWID)) {
pd.m->m_pkthdr.ph_flowid = bemtoh64(&s->id);
+ SET(pd.m->m_pkthdr.csum_flags, M_FLOWID);
+ }
/*
* connections redirected to loopback should not match sockets