diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-11-30 00:08:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-11-30 00:08:00 +0000 |
commit | 3b053537c9c160ca895d7d2f21ea723179566401 (patch) | |
tree | 427c63294041a6c430062fb6469d6ebd7804f63b | |
parent | 7fa64e9dcc6785cff20464c583e88596db64d2ab (diff) | |
download | strace-3b053537c9c160ca895d7d2f21ea723179566401.tar.gz |
socketutils: fix protocol lookup in get_sockaddr_by_inode_lookup
If getfdproto() fails to obtain system.sockprotoname attribute,
it returns SOCK_PROTO_UNKNOWN. When this happens,
get_sockaddr_by_inode_lookup() receives no hints about the protocol
number and falls back to iterating over the protocols table.
Apparently, it failed to implement this properly.
* src/socketutils.c (get_sockaddr_by_inode_lookup): When iterating
over protocols table, pass data from protocols[i] instead of
protocols[SOCK_PROTO_UNKNOWN] to protocols[i].get().
Fixes: v4.25~37 "socketutils: store more information in protocols table"
-rw-r--r-- | src/socketutils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/socketutils.c b/src/socketutils.c index 67a23cd47..dcf553cce 100644 --- a/src/socketutils.c +++ b/src/socketutils.c @@ -504,10 +504,10 @@ get_sockaddr_by_inode_lookup(struct tcb *tcp, const unsigned long inode, if (!protocols[i].get) continue; details = protocols[i].get(tcp, fd, - protocols[proto].family, - protocols[proto].proto, + protocols[i].family, + protocols[i].proto, inode, - protocols[proto].name); + protocols[i].name); if (details) break; } |