From: Vadim Kochan <vadim4j@gmail.com>
To: netdev@vger.kernel.org
Cc: Vadim Kochan <vadim4j@gmail.com>
Subject: [PATCH iproute2 2/7] ss: Replace pktstat struct by new sockstat struct
Date: Fri, 13 Feb 2015 22:13:59 +0200 [thread overview]
Message-ID: <1423858444-10158-3-git-send-email-vadim4j@gmail.com> (raw)
In-Reply-To: <1423858444-10158-1-git-send-email-vadim4j@gmail.com>
From: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
misc/ss.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 7e11fc0..f033892 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -692,6 +692,8 @@ static const char *sstate_namel[] = {
struct sockstat
{
+ uint8_t type;
+ uint16_t prot;
inet_prefix local;
inet_prefix remote;
int lport;
@@ -2719,29 +2721,18 @@ static int unix_show(struct filter *f)
return 0;
}
-struct pktstat {
- uint8_t type;
- uint16_t prot;
- uint32_t iface;
- int state;
- uint32_t rq;
- uid_t uid;
- ino_t ino;
-};
-
-static int packet_stats_print(struct pktstat *s, const struct filter *f)
+static int packet_stats_print(struct sockstat *s, const struct filter *f)
{
char *buf = NULL;
if (f->f) {
- struct sockstat st;
- st.local.family = AF_PACKET;
- st.remote.family = AF_PACKET;
- st.rport = 0;
- st.lport = s->iface;
- st.local.data[0] = s->prot;
- st.remote.data[0] = 0;
- if (run_ssfilter(f->f, &st) == 0)
+ s->local.family = AF_PACKET;
+ s->remote.family = AF_PACKET;
+ s->rport = 0;
+ s->lport = s->iface;
+ s->local.data[0] = s->prot;
+ s->remote.data[0] = 0;
+ if (run_ssfilter(f->f, s) == 0)
return 1;
}
@@ -2790,7 +2781,7 @@ static int packet_show_sock(const struct sockaddr_nl *addr,
const struct filter *f = arg;
struct packet_diag_msg *r = NLMSG_DATA(nlh);
struct rtattr *tb[PACKET_DIAG_MAX+1];
- struct pktstat stat = {};
+ struct sockstat stat = {};
parse_rtattr(tb, PACKET_DIAG_MAX, (struct rtattr*)(r+1),
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
@@ -2859,7 +2850,7 @@ static int packet_show_netlink(struct filter *f)
static int packet_show_line(char *buf, const struct filter *f, int fam)
{
unsigned long long sk;
- struct pktstat stat = {};
+ struct sockstat stat = {};
int type, prot, iface, state, rq, uid, ino;
sscanf(buf, "%llx %*d %d %x %d %d %u %u %u",
--
2.2.2
next prev parent reply other threads:[~2015-02-13 20:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-13 20:13 [PATCH iproute2 0/7] ss: Unify socket info output to common funcs Vadim Kochan
2015-02-13 20:13 ` [PATCH iproute2 1/7] ss: Split tcpstap struct to sockstat & tcpstat Vadim Kochan
2015-02-13 20:13 ` Vadim Kochan [this message]
2015-02-13 20:14 ` [PATCH iproute2 3/7] ss: Replace unixstat struct by new sockstat struct Vadim Kochan
2015-02-13 20:14 ` [PATCH iproute2 4/7] ss: Unify state socket output:netid, state, rq, wq Vadim Kochan
2015-02-13 20:14 ` [PATCH iproute2 5/7] ss: Unify details info output:ino,uid,sk Vadim Kochan
2015-02-13 20:14 ` [PATCH iproute2 6/7] ss: Unify socket address output by one generic func Vadim Kochan
2015-02-13 20:14 ` [PATCH iproute2 7/7] ss: Fixed wrong tcp ato value from netlink Vadim Kochan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423858444-10158-3-git-send-email-vadim4j@gmail.com \
--to=vadim4j@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).