Skip to content

Commit

Permalink
Add linux support for reading tcp6/udp6 sock tables
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxp1998 committed Jan 4, 2020
1 parent 9905386 commit 496a7e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pub(crate) fn get_open_sockets() -> HashMap<Connection, String> {
}
}

let tcp = ::procfs::net::tcp().unwrap();
let tcp = ::procfs::net::tcp()
.unwrap()
.append(&mut ::procfs::net::tcp6().unwrap());
for entry in tcp.into_iter() {
let local_port = entry.local_address.port();
if let (connection, Some(procname)) = (
Expand All @@ -31,7 +33,9 @@ pub(crate) fn get_open_sockets() -> HashMap<Connection, String> {
};
}

let udp = ::procfs::net::udp().unwrap();
let udp = ::procfs::net::udp()
.unwrap()
.append(&mut ::procfs::net::udp6().unwrap());
for entry in udp.into_iter() {
let local_port = entry.local_address.port();
if let (connection, Some(procname)) = (
Expand Down

0 comments on commit 496a7e1

Please sign in to comment.