lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <1423858444-10158-3-git-send-email-vadim4j@gmail.com> Date: Fri, 13 Feb 2015 22:13:59 +0200 From: Vadim Kochan <vadim4j@...il.com> To: netdev@...r.kernel.org Cc: Vadim Kochan <vadim4j@...il.com> Subject: [PATCH iproute2 2/7] ss: Replace pktstat struct by new sockstat struct From: Vadim Kochan <vadim4j@...il.com> Signed-off-by: Vadim Kochan <vadim4j@...il.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 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists