aboutgitcodebugslistschat
path: root/tcp_conn.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-07 13:42:41 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-11-07 09:53:54 +0100
commit536acab2de70468b3d8e6b5f876576525ce82258 (patch)
tree2cc371b2bea581c876335095a2d3fb05abb4e7e6 /tcp_conn.h
parentd33cbc600e4d95356e1e80937dad0d3ef21e959e (diff)
downloadpasst-536acab2de70468b3d8e6b5f876576525ce82258.tar
passt-536acab2de70468b3d8e6b5f876576525ce82258.tar.gz
passt-536acab2de70468b3d8e6b5f876576525ce82258.tar.bz2
passt-536acab2de70468b3d8e6b5f876576525ce82258.tar.lz
passt-536acab2de70468b3d8e6b5f876576525ce82258.tar.xz
passt-536acab2de70468b3d8e6b5f876576525ce82258.tar.zst
passt-536acab2de70468b3d8e6b5f876576525ce82258.zip
tcp_splice: Correct error handling in tcp_splice_epoll_ctl()
If we get an error from epoll_ctl() in tcp_splice_epoll_ctl() we goto the 'delete' path where we remove both sockets from the epoll set and return an error. There are several problems with this: - We 'return -errno' after the EPOLL_CTL_DEL operations, which means the deleting epoll_ctl() calls may have overwritten the errno values which actually triggered the failures. - The call from conn_flag_do() occurs when the CLOSING flag is set, in which case we go do the delete path regardless of error. In that case the 'return errno' is meaningless since we don't expect the EPOLL_CTL_DEL operations to fail and we ignore the return code anyway. - All other calls to tcp_splice_epoll_ctl() check the return code and if non-zero immediately call conn_flag(..., CLOSING) which will call tcp_splice_epoll_ctl() again explicitly to remove the sockets from epoll. That means removing them when the error first occurs is redundant. - We never specifically report an error on the epoll_ctl() operations. We just set the connection to CLOSING, more or less silently killing it. This could make debugging difficult in the unlikely even that we get a failure here. Re-organise tcp_splice_epoll_ctl() to just log a message then return in the error case, and only EPOLL_CTL_DEL when explicitly asked to with the CLOSING flag. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_conn.h')
0 files changed, 0 insertions, 0 deletions