netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Kochan <vadim4j@gmail.com>
To: netdev@vger.kernel.org
Cc: Vadim Kochan <vadim4j@gmail.com>
Subject: [PATCH iproute2] ip monitor: Fixed printing timestamp few times
Date: Mon,  1 Dec 2014 01:14:22 +0200	[thread overview]
Message-ID: <1417389262-25189-1-git-send-email-vadim4j@gmail.com> (raw)

Another fix when timestamp is printed few times
before the event message.

Fixed by skipping the message types which are not supported.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 ip/ipmonitor.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 4cc75f4..5c3ed18 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -42,6 +42,15 @@ static int accept_msg(const struct sockaddr_nl *who,
 {
 	FILE *fp = (FILE*)arg;
 
+	if (n->nlmsg_type == RTM_NEWQDISC ||
+	    n->nlmsg_type == RTM_DELQDISC ||
+	    n->nlmsg_type == RTM_NEWTCLASS ||
+	    n->nlmsg_type == RTM_DELTCLASS ||
+	    n->nlmsg_type == RTM_NEWTFILTER ||
+	    n->nlmsg_type == RTM_DELTFILTER ||
+	    n->nlmsg_type == RTM_NEWNDUSEROPT)
+		return 0;
+
 	if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
 		struct rtmsg *r = NLMSG_DATA(n);
 		int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*r));
@@ -134,14 +143,6 @@ static int accept_msg(const struct sockaddr_nl *who,
 		fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
 		return 0;
 	}
-	if (n->nlmsg_type == RTM_NEWQDISC ||
-	    n->nlmsg_type == RTM_DELQDISC ||
-	    n->nlmsg_type == RTM_NEWTCLASS ||
-	    n->nlmsg_type == RTM_DELTCLASS ||
-	    n->nlmsg_type == RTM_NEWTFILTER ||
-	    n->nlmsg_type == RTM_DELTFILTER ||
-	    n->nlmsg_type == RTM_NEWNDUSEROPT)
-		return 0;
 	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
 	    n->nlmsg_type != NLMSG_DONE) {
 		fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)"
-- 
2.1.3

             reply	other threads:[~2014-11-30 23:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-30 23:14 Vadim Kochan [this message]
2014-12-03 17:13 ` [PATCH iproute2] ip monitor: Fixed printing timestamp few times Stephen Hemminger
2014-12-03 17:11   ` vadim4j
2014-12-03 17:47     ` Stephen Hemminger
2014-12-03 17:41       ` vadim4j
2014-12-04 21:43         ` Vadim Kochan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417389262-25189-1-git-send-email-vadim4j@gmail.com \
    --to=vadim4j@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).