]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
mptcp: sockopt: info: stop early if no buffer
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Tue, 14 May 2024 01:13:27 +0000 (18:13 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 14 May 2024 01:29:22 +0000 (18:29 -0700)
commitce5f6f71b029f6a96267a7d876da4a055d7d1611
tree2fba6dc4b36d49853bb480eeb323009861ba85c0
parentbd11dc4fb969ec148e50cd87f88a78246dbc4d0b
mptcp: sockopt: info: stop early if no buffer

Up to recently, it has been recommended to use getsockopt(MPTCP_INFO) to
check if a fallback to TCP happened, or if the client requested to use
MPTCP.

In this case, the userspace app is only interested by the returned value
of the getsocktop() call, and can then give 0 for the option length, and
NULL for the buffer address. An easy optimisation is then to stop early,
and avoid filling a local buffer -- which now requires two different
locks -- if it is not needed.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Mat Martineau <martineau@kernel.org>
Link: https://lore.kernel.org/r/20240514011335.176158-4-martineau@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/sockopt.c