diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-02-11 05:11:05 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-02-11 05:11:05 +0000 |
commit | f213fb130c5b1982f15f6362f81f421f8e41da9e (patch) | |
tree | 1ca294b3bacb8f258d7edb337fede4434ac37468 /lib/libkvm | |
parent | fc8a6834e1c294e9addb85278c096440a7a78c85 (diff) |
Extend struct kinfo_file a bit for netstat (sync with the kernel).
Bump minor number because of this.
OK guenther@
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm_file2.c | 33 | ||||
-rw-r--r-- | lib/libkvm/shlib_version | 2 |
2 files changed, 33 insertions, 2 deletions
diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c index 2b8157f5773..3caa613d6f8 100644 --- a/lib/libkvm/kvm_file2.c +++ b/lib/libkvm/kvm_file2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_file2.c,v 1.43 2015/02/11 04:00:05 guenther Exp $ */ +/* $OpenBSD: kvm_file2.c,v 1.44 2015/02/11 05:11:04 claudio Exp $ */ /* * Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com> @@ -97,6 +97,9 @@ #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/in_pcb.h> +#include <netinet/tcp.h> +#include <netinet/tcp_timer.h> +#include <netinet/tcp_var.h> #ifdef INET6 #include <netinet/ip6.h> @@ -593,6 +596,20 @@ fill_file(kvm_t *kd, struct kinfo_file *kf, struct file *fp, u_long fpaddr, kf->inp_fport = inpcb.inp_fport; kf->inp_faddru[0] = inpcb.inp_faddr.s_addr; kf->inp_rtableid = inpcb.inp_rtableid; + if (sock.so_type == SOCK_RAW) + kf->inp_proto = inpcb.inp_ip.ip_p; + if (protosw.pr_protocol == IPPROTO_TCP) { + struct tcpcb tcpcb; + if (KREAD(kd, (u_long)inpcb.inp_ppcb, &tcpcb)) { + _kvm_err(kd, kd->program, + "can't read tcpcb"); + return (-1); + } + kf->t_rcv_wnd = tcpcb.rcv_wnd; + kf->t_snd_wnd = tcpcb.snd_wnd; + kf->t_snd_cwnd = tcpcb.snd_cwnd; + kf->t_state = tcpcb.t_state; + } break; } case AF_INET6: { @@ -615,6 +632,20 @@ fill_file(kvm_t *kd, struct kinfo_file *kf, struct file *fp, u_long fpaddr, kf->inp_faddru[2] = inpcb.inp_faddr6.s6_addr32[2]; kf->inp_faddru[3] = inpcb.inp_faddr6.s6_addr32[3]; kf->inp_rtableid = inpcb.inp_rtableid; + if (sock.so_type == SOCK_RAW) + kf->inp_proto = inpcb.inp_ipv6.ip6_nxt; + if (protosw.pr_protocol == IPPROTO_TCP) { + struct tcpcb tcpcb; + if (KREAD(kd, (u_long)inpcb.inp_ppcb, &tcpcb)) { + _kvm_err(kd, kd->program, + "can't read tcpcb"); + return (-1); + } + kf->t_rcv_wnd = tcpcb.rcv_wnd; + kf->t_snd_wnd = tcpcb.snd_wnd; + kf->t_snd_cwnd = tcpcb.snd_cwnd; + kf->t_state = tcpcb.t_state; + } break; } case AF_UNIX: { diff --git a/lib/libkvm/shlib_version b/lib/libkvm/shlib_version index 84e2c2920d7..796ed4662c9 100644 --- a/lib/libkvm/shlib_version +++ b/lib/libkvm/shlib_version @@ -1,2 +1,2 @@ major=16 -minor=0 +minor=1 |