All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: eric.dumazet@gmail.com
Cc: shemminger@vyatta.com, netdev@vger.kernel.org, tgraf@suug.ch,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH iproute2 v3] libnetlink: check flag NLM_F_DUMP_INTR during dumps
Date: Fri, 22 Mar 2013 17:34:02 +0100	[thread overview]
Message-ID: <1363970042-12625-1-git-send-email-nicolas.dichtel@6wind.com> (raw)
In-Reply-To: <1363967372.4431.71.camel@edumazet-glaptop>

When this flag is set, it means that dump was interrupted and result may be
inconsistent.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---

v3: display the warning only once
v2: do not stop the dump, only display a warning

 lib/libnetlink.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index f262959..04201cd 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -194,6 +194,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
 		.msg_iovlen = 1,
 	};
 	char buf[16384];
+	int dump_intr = 0;
 
 	iov.iov_base = buf;
 	while (1) {
@@ -230,6 +231,9 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
 				    h->nlmsg_seq != rth->dump)
 					goto skip_it;
 
+				if (h->nlmsg_flags & NLM_F_DUMP_INTR)
+					dump_intr = 1;
+
 				if (h->nlmsg_type == NLMSG_DONE) {
 					found_done = 1;
 					break; /* process next filter */
@@ -254,8 +258,12 @@ skip_it:
 			}
 		}
 
-		if (found_done)
+		if (found_done) {
+			if (dump_intr)
+				fprintf(stderr,
+					"Dump was interrupted and may be inconsistent.\n");
 			return 0;
+		}
 
 		if (msg.msg_flags & MSG_TRUNC) {
 			fprintf(stderr, "Message truncated\n");
-- 
1.8.0.1

  reply	other threads:[~2013-03-22 16:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 14:45 [PATCH iproute2] libnetlink: check flag NLM_F_DUMP_INTR during dumps Nicolas Dichtel
2013-03-22 14:59 ` Eric Dumazet
2013-03-22 15:03   ` Nicolas Dichtel
2013-03-22 15:14     ` Eric Dumazet
2013-03-22 15:22       ` Thomas Graf
2013-03-22 15:42         ` [PATCH iproute2 v2] " Nicolas Dichtel
2013-03-22 15:49           ` Eric Dumazet
2013-03-22 16:34             ` Nicolas Dichtel [this message]
2013-03-24 21:17               ` [PATCH net-next v2 2/2] ipv6: provide addr and netconf dump consistency info David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-03-22 14:42 [PATCH net-next 1/2] ipv4: " Nicolas Dichtel
2013-03-22 14:42 ` [PATCH net-next 2/2] ipv6: " Nicolas Dichtel
2013-03-22 16:22   ` Nicolas Dichtel
2013-03-22 16:28     ` [PATCH net-next v2 1/2] ipv4: " Nicolas Dichtel
2013-03-22 16:28       ` [PATCH net-next v2 2/2] ipv6: " Nicolas Dichtel
2013-03-24 21:16       ` [PATCH net-next v2 1/2] ipv4: " David Miller

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=1363970042-12625-1-git-send-email-nicolas.dichtel@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=tgraf@suug.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.