From 9a28438540b7db7e41e7018f50eb881eb1bc0306 Mon Sep 17 00:00:00 2001 From: Davide Caratti Date: Tue, 27 Sep 2022 18:06:36 +0200 Subject: [PATCH] display filters for TC ingress and egress the TC clsact qdisc has the same handle as ingress: however, ingress and egress filters parent to ffff:fff2 and ffff:fff3 respectively. Explicitly request the above 2 handles, so that ingress and egress filters attached to clsact are displayed. Signed-off-by: Davide Caratti --- src/in_netlink.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/in_netlink.c b/src/in_netlink.c index 4b5e3b1..bd82a75 100644 --- a/src/in_netlink.c +++ b/src/in_netlink.c @@ -672,14 +672,27 @@ static void handle_qdisc(struct nl_object *obj, void *arg) ndata.parent = e; - find_cls(rtnl_tc_get_ifindex(tc), rtnl_tc_get_handle(tc), &ndata); - - if (rtnl_tc_get_parent(tc) == TC_H_ROOT) { + switch(rtnl_tc_get_parent(tc)) { + case TC_H_INGRESS: + if (!strcmp(rtnl_tc_get_kind(tc), "clsact")) { + find_cls(rtnl_tc_get_ifindex(tc), + TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS), + &ndata); + find_cls(rtnl_tc_get_ifindex(tc), + TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS), + &ndata); + } else { + find_cls(rtnl_tc_get_ifindex(tc), TC_H_INGRESS, &ndata); + } + break; + case TC_H_ROOT: find_cls(rtnl_tc_get_ifindex(tc), TC_H_ROOT, &ndata); find_classes(TC_H_ROOT, &ndata); + /* fall-through */ + default: + find_cls(rtnl_tc_get_ifindex(tc), rtnl_tc_get_handle(tc), &ndata); + find_classes(rtnl_tc_get_handle(tc), &ndata); } - - find_classes(rtnl_tc_get_handle(tc), &ndata); } static void handle_tc(struct element *e, struct rtnl_link *link)