tcp_splice: Don't use flow_trace() before setting flow type
In tcp_splice_conn_from_sock() we can call flow_trace() if there's an error setting TCP_QUICKACK. However, we do so before we've set the flow type in the flow entry. That means that flow_trace() will print nonsense when it tries to print the flow type. There's no reason the setsockopt() has to happen before initialising the flow entry, so just move it after. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
80f9b61b50
commit
d0550f97cd
1 changed files with 3 additions and 3 deletions
|
@ -453,9 +453,6 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
|
||||||
if (!inany_is_loopback(&aany))
|
if (!inany_is_loopback(&aany))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (setsockopt(s, SOL_TCP, TCP_QUICKACK, &((int){ 1 }), sizeof(int)))
|
|
||||||
flow_trace(conn, "failed to set TCP_QUICKACK on %i", s);
|
|
||||||
|
|
||||||
conn->f.type = FLOW_TCP_SPLICE;
|
conn->f.type = FLOW_TCP_SPLICE;
|
||||||
conn->flags = inany_v4(&aany) ? 0 : SPLICE_V6;
|
conn->flags = inany_v4(&aany) ? 0 : SPLICE_V6;
|
||||||
conn->s[0] = s;
|
conn->s[0] = s;
|
||||||
|
@ -463,6 +460,9 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
|
||||||
conn->pipe[0][0] = conn->pipe[0][1] = -1;
|
conn->pipe[0][0] = conn->pipe[0][1] = -1;
|
||||||
conn->pipe[1][0] = conn->pipe[1][1] = -1;
|
conn->pipe[1][0] = conn->pipe[1][1] = -1;
|
||||||
|
|
||||||
|
if (setsockopt(s, SOL_TCP, TCP_QUICKACK, &((int){ 1 }), sizeof(int)))
|
||||||
|
flow_trace(conn, "failed to set TCP_QUICKACK on %i", s);
|
||||||
|
|
||||||
if (tcp_splice_new(c, conn, ref.port, ref.pif))
|
if (tcp_splice_new(c, conn, ref.port, ref.pif))
|
||||||
conn_flag(c, conn, CLOSING);
|
conn_flag(c, conn, CLOSING);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue