From a6928a0bd61db4cf7a11a3d35e8385fc0ad85f19 Mon Sep 17 00:00:00 2001 From: adrian Date: Mon, 10 Feb 2014 06:29:05 +0000 Subject: [PATCH] MFC r260871: If the flowid is available for the mbuf that finalised the creation of a syncache connection, copy it into the inp_flowid field. Without this, an incoming TCP connection won't have an inp_flowid marked until some data comes in, and this means that things like the per-CPU TCP timer option will choose a different CPU for the timer work. (It also means that if one grabbed the flowid via an ioctl from userland, it won't be available until some data has been received.) Sponsored by: Netflix, Inc. git-svn-id: svn://svn.freebsd.org/base/stable/10@261705 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netinet/tcp_syncache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 1c27d7a02..2ade9ee94 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -720,6 +720,16 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) } #endif + /* + * If there's an mbuf and it has a flowid, then let's initialise the + * inp with that particular flowid. + */ + if (m != NULL && m->m_flags & M_FLOWID) { + inp->inp_flags |= INP_HW_FLOWID; + inp->inp_flags &= ~INP_SW_FLOWID; + inp->inp_flowid = m->m_pkthdr.flowid; + } + /* * Install in the reservation hash table for now, but don't yet * install a connection group since the full 4-tuple isn't yet -- 2.45.0