]> git.baikalelectronics.ru Git - kernel.git/commit
net: diag: document swapped src/dst in udp_dump_one.
authorLorenzo Colitti <lorenzo@google.com>
Mon, 29 Oct 2018 00:15:22 +0000 (09:15 +0900)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Oct 2018 02:27:21 +0000 (19:27 -0700)
commitf519f4292e948931dc3cb1e6d00f61f63f4dae7d
treea1537a109e82873ad423a4f836457ebc426f0990
parent9ccffc2ee2d2faec408f4db74c094c5ef934e598
net: diag: document swapped src/dst in udp_dump_one.

Since its inception, udp_dump_one has had a bug where userspace
needs to swap src and dst addresses and ports in order to find
the socket it wants. This is because it passes the socket source
address to __udp[46]_lib_lookup's saddr argument, but those
functions are intended to find local sockets matching received
packets, so saddr is the remote address, not the local address.

This can no longer be fixed for backwards compatibility reasons,
so add a brief comment explaining that this is the case. This
will avoid confusion and help ensure SOCK_DIAG implementations
of new protocols don't have the same problem.

Fixes: b4e28dc3d32 ("udp_diag: Implement the get_exact dumping functionality")
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp_diag.c