diff mbox

[iproute2,1/1] tc: distinguish Add/Replace filter operations

Message ID 1479335420-32088-1-git-send-email-mrv@mojatatu.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Roman Mashak Nov. 16, 2016, 10:30 p.m. UTC
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 tc/tc_filter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Stephen Hemminger Nov. 29, 2016, 9:26 p.m. UTC | #1
On Wed, 16 Nov 2016 17:30:20 -0500
Roman Mashak <mrv@mojatatu.com> wrote:

> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

Applied, and queued for next push
diff mbox

Patch

diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 932677a..ff8713b 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -226,6 +226,16 @@  int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 	if (n->nlmsg_type == RTM_DELTFILTER)
 		fprintf(fp, "deleted ");
 
+	if (n->nlmsg_type == RTM_NEWTFILTER &&
+			(n->nlmsg_flags & NLM_F_CREATE) &&
+			!(n->nlmsg_flags & NLM_F_EXCL))
+		fprintf(fp, "replaced ");
+
+	if (n->nlmsg_type == RTM_NEWTFILTER &&
+			(n->nlmsg_flags & NLM_F_CREATE) &&
+			(n->nlmsg_flags & NLM_F_EXCL))
+		fprintf(fp, "added ");
+
 	fprintf(fp, "filter ");
 	if (!filter_ifindex || filter_ifindex != t->tcm_ifindex)
 		fprintf(fp, "dev %s ", ll_index_to_name(t->tcm_ifindex));