diff mbox

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

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

Commit Message

Roman Mashak Jan. 22, 2017, 1:55 p.m. UTC
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 tc/m_action.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Phil Sutter Jan. 27, 2017, 11:37 a.m. UTC | #1
On Sun, Jan 22, 2017 at 08:55:33AM -0500, Roman Mashak wrote:
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

Acked-by: Phil Sutter <phil@nwl.cc>
Stephen Hemminger Jan. 30, 2017, 4:27 a.m. UTC | #2
On Sun, 22 Jan 2017 08:55:33 -0500
Roman Mashak <mrv@mojatatu.com> wrote:

> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
>  tc/m_action.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Applied, thanks
diff mbox

Patch

diff --git a/tc/m_action.c b/tc/m_action.c
index bb19df8..05ef07e 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -365,12 +365,18 @@  int print_action(const struct sockaddr_nl *who,
 			fprintf(fp, "Flushed table ");
 			tab_flush = 1;
 		} else {
-			fprintf(fp, "deleted action ");
+			fprintf(fp, "Deleted action ");
 		}
 	}
 
-	if (n->nlmsg_type == RTM_NEWACTION)
-		fprintf(fp, "Added action ");
+	if (n->nlmsg_type == RTM_NEWACTION) {
+		if ((n->nlmsg_flags & NLM_F_CREATE) &&
+		    !(n->nlmsg_flags & NLM_F_REPLACE)) {
+			fprintf(fp, "Added action ");
+		} else if (n->nlmsg_flags & NLM_F_REPLACE) {
+			fprintf(fp, "Replaced action ");
+		}
+	}
 	tc_print_action(fp, tb[TCA_ACT_TAB]);
 
 	return 0;