aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-09-18 11:53:06 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-09-18 17:14:50 +0200
commit265b2099c7715a3432eef00acd1faea7cbc1eb25 (patch)
tree05f12e8241b92b519775f8a539e043c057c303e0
parent4aff6f93923327cb875ceacf12ef0ffc2e613174 (diff)
downloadpasst-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar.gz
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar.bz2
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar.lz
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar.xz
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.tar.zst
passt-265b2099c7715a3432eef00acd1faea7cbc1eb25.zip
tcp: Simplify ifdef logic in tcp_update_seqack_wnd()
This function has a block conditional on !snd_wnd_cap shortly before an snd_wnd_cap is statically false). Therefore, simplify this down to a single conditional with an else branch. While we're there, fix some improperly indented closing braces. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tcp.c b/tcp.c
index cba3f3b..92ac164 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1066,14 +1066,13 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
if (!tinfo) {
if (prev_wnd_to_tap > WINDOW_DEFAULT) {
goto out;
-}
+ }
tinfo = &tinfo_new;
if (getsockopt(s, SOL_TCP, TCP_INFO, tinfo, &sl)) {
goto out;
-}
+ }
}
-#ifdef HAS_SND_WND
if ((conn->flags & LOCAL) || tcp_rtt_dst_low(conn)) {
new_wnd_to_tap = tinfo->tcpi_snd_wnd;
} else {
@@ -1081,7 +1080,6 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
new_wnd_to_tap = MIN((int)tinfo->tcpi_snd_wnd,
SNDBUF_GET(conn));
}
-#endif
new_wnd_to_tap = MIN(new_wnd_to_tap, MAX_WINDOW);
if (!(conn->events & ESTABLISHED))