Skip to content

diag: add support for SOCK_DESTROY#15

Merged
cathay4t merged 1 commit into
rust-netlink:mainfrom
anisse:sock-destroy
Jul 3, 2026
Merged

diag: add support for SOCK_DESTROY#15
cathay4t merged 1 commit into
rust-netlink:mainfrom
anisse:sock-destroy

Conversation

@anisse

@anisse anisse commented Oct 14, 2023

Copy link
Copy Markdown
Contributor

It is implemented on top of SockDiagMessage, and allows using Linux's CONFIG_INET_DIAG_DESTROY feature to close an arbitrary socket.

A long running, but buggy process might have hanging sockets kept alive by error. Using SOCK_DESTROY allows closing arbitrary sockets as root; an example tool that uses this feature and this crate is at: https://github.com/anisse/tcpkill

This PR should replace this one: little-dude/netlink#283

@codecov

codecov Bot commented Oct 14, 2023

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 38.31%. Comparing base (f5f4ad7) to head (6b9660d).

Files with missing lines Patch % Lines
src/message.rs 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
- Coverage   39.34%   38.31%   -1.04%     
==========================================
  Files          11       11              
  Lines         854      877      +23     
==========================================
  Hits          336      336              
- Misses        518      541      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

It is implemented on top of SockDiagMessage, and allows using Linux's
CONFIG_INET_DIAG_DESTROY feature to close an arbitrary socket.

A long running, but buggy process might have hanging sockets kept alive
by error. Using SOCK_DESTROY allows closing arbitrary sockets as root;
an example tool that uses this feature and this crate is at:
https://github.com/anisse/tcpkill
@cathay4t
cathay4t merged commit e727515 into rust-netlink:main Jul 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants