-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Clean map when destroy socket (#691)
* feat: Clean map when destroy socket When a socket has been closed in kernel, the corresponding connection info in user space should be cleaned in order to avoid memory leaking. Then, in user space, use another map to keep pid and fd for the socket with socket pointer in kernel space as key. It is because the tuple info in the socket is incorrect when destroy it. e.g. ``` 2024-12-13T13:23:10Z DBG AddConn success fd=5 pid=134386 tuple=192.168.241.133:35348-172.217.194.113:443 2024-12-13T13:23:10Z DBG DestroyConn success fd=5 pid=134386 tuple=192.168.241.133:35348-172.217.194.113:443 2024-12-13T13:23:16Z DBG AddConn success fd=4 pid=134404 tuple=192.168.241.1:65063-192.168.241.133:8080 2024-12-13T13:23:16Z DBG DestroyConn success fd=4 pid=134404 tuple=192.168.241.1:65063-192.168.241.133:8080 ``` Signed-off-by: Leon Hwang <hffilwlqm@gmail.com> * fix: Only handle tcp socket when probe connect and accept It's unnecessary to record excluding-tcp sockets' info. So, when probe connect and accept, we only handle tcp socket by filtering `sk->sk_protocol`. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com> --------- Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
- Loading branch information
Showing
4 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters