[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1476696885-22214-1-git-send-email-jhs@emojatatu.com>
Date: Mon, 17 Oct 2016 05:34:44 -0400
From: Jamal Hadi Salim <jhs@...atatu.com>
To: stephen@...workplumber.org
Cc: netdev@...r.kernel.org, daniel@...earbox.net,
xiyou.wangcong@...il.com, mrv@...atatu.com,
Jamal Hadi Salim <jhs@...atatu.com>
Subject: [PATCH iproute2 1/2] tc filters: display handle in events when a filter is deleted
From: Jamal Hadi Salim <jhs@...atatu.com>
An event being displayed via "tc mon" should display the filter handle.
The filter handle is a required parameter when deleting a filter and
therefore the delete event should mimic/mirror the command sent.
A simple test, run tc monitor on one window, on another try adding
a filter:
..
sudo $TC filter add dev $ETH parent ffff: protocol ip pref 1 \
u32 match ip protocol 1 0xff \
flowid 1:1 \
action ok
..
.. get its handle by dumping ...
sudo $TC -s filter ls dev $ETH parent ffff: protocol ip
... find out the handle (say it was 800::800)
... go delete it..
sudo $TC filter del dev $ETH handle 800::800 parent ffff: \
protocol ip prio 1 u32
now see tc monitor reporting it without handle. After this patch
with a handle.
Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
---
tc/tc_filter.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 2413cef..4efc44f 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -253,12 +253,13 @@ int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
}
fprintf(fp, "%s ", rta_getattr_str(tb[TCA_KIND]));
q = get_filter_kind(RTA_DATA(tb[TCA_KIND]));
- if (tb[TCA_OPTIONS]) {
+ if (tb[TCA_OPTIONS] || n->nlmsg_type == RTM_DELTFILTER) {
if (q)
q->print_fopt(q, fp, tb[TCA_OPTIONS], t->tcm_handle);
else
fprintf(fp, "[cannot parse parameters]");
}
+
fprintf(fp, "\n");
if (show_stats && (tb[TCA_STATS] || tb[TCA_STATS2])) {
--
1.9.1
Powered by blists - more mailing lists