diff mbox

[iproute2] ss: Use nl_proto_a2n for filtering by netlink proto

Message ID 1417827139-10241-1-git-send-email-vadim4j@gmail.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Vadym Kochan Dec. 6, 2014, 12:52 a.m. UTC
Now it is posible to filter by existing Netlink protos:

    ss -A netlink src uevent
    ss -A netlink src nft
    ss -A netlink src genl

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 misc/ss.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Stephen Hemminger Dec. 10, 2014, 4:40 a.m. UTC | #1
On Sat,  6 Dec 2014 02:52:19 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> Now it is posible to filter by existing Netlink protos:
> 
>     ss -A netlink src uevent
>     ss -A netlink src nft
>     ss -A netlink src genl
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>

Applied
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/ss.c b/misc/ss.c
index a99294d..b9dbfd6 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1231,16 +1231,8 @@  void *parse_hostcond(char *addr)
 		}
 		if (addr[0] && strcmp(addr, "*")) {
 			a.addr.bitlen = 32;
-			if (get_u32(a.addr.data, addr, 0)) {
-				if (strcmp(addr, "rtnl") == 0)
-					a.addr.data[0] = 0;
-				else if (strcmp(addr, "fw") == 0)
-					a.addr.data[0] = 3;
-				else if (strcmp(addr, "tcpdiag") == 0)
-					a.addr.data[0] = 4;
-				else
-					return NULL;
-			}
+			if (nl_proto_a2n(&a.addr.data[0], addr) == -1)
+				return NULL;
 		}
 		goto out;
 	}