Skip to contentSkip to conversation

ss: Use nl_proto_a2n for filtering by netlink proto

PATCH Applied Vadim Kochan 2 participants 2 messages Dec 6, 2014 – Dec 10, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: Use nl_proto_a2n for filtering by netlink proto

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

---
 misc/ss.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
misc/ss.c +2 -10
index a99294d..b9dbfd6 100644
@@ -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;
 	}
Signature · 1 line
2.1.3