diff mbox

[iproute2] libnetlink: check flag NLM_F_DUMP_INTR during dumps

Message ID 1363963557-3888-1-git-send-email-nicolas.dichtel@6wind.com
State Superseded, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nicolas Dichtel March 22, 2013, 2:45 p.m. UTC
When this flag is set, it means that dump was interrupted and result may be
wrong. Ask user to restart.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 lib/libnetlink.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Eric Dumazet March 22, 2013, 2:59 p.m. UTC | #1
On Fri, 2013-03-22 at 15:45 +0100, Nicolas Dichtel wrote:
> When this flag is set, it means that dump was interrupted and result may be
> wrong. Ask user to restart.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>


Do we have a guarantee this will complete eventually, on some hosts
constantly adding removing entries ?



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Dichtel March 22, 2013, 3:03 p.m. UTC | #2
Le 22/03/2013 15:59, Eric Dumazet a écrit :
> On Fri, 2013-03-22 at 15:45 +0100, Nicolas Dichtel wrote:
>> When this flag is set, it means that dump was interrupted and result may be
>> wrong. Ask user to restart.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
>
> Do we have a guarantee this will complete eventually, on some hosts
> constantly adding removing entries ?
>

No. You mean it will be better to just print a warning and continue the dump?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet March 22, 2013, 3:14 p.m. UTC | #3
On Fri, 2013-03-22 at 16:03 +0100, Nicolas Dichtel wrote:
> Le 22/03/2013 15:59, Eric Dumazet a écrit :
> > On Fri, 2013-03-22 at 15:45 +0100, Nicolas Dichtel wrote:
> >> When this flag is set, it means that dump was interrupted and result may be
> >> wrong. Ask user to restart.
> >>
> >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> >
> >
> > Do we have a guarantee this will complete eventually, on some hosts
> > constantly adding removing entries ?
> >
> 
> No. You mean it will be better to just print a warning and continue the dump?
> --

I would not break the dump, return the indication, so that caller can
chose to restart the loop one or two times.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Graf March 22, 2013, 3:22 p.m. UTC | #4
On 03/22/13 at 08:14am, Eric Dumazet wrote:
> On Fri, 2013-03-22 at 16:03 +0100, Nicolas Dichtel wrote:
> > Le 22/03/2013 15:59, Eric Dumazet a écrit :
> > > On Fri, 2013-03-22 at 15:45 +0100, Nicolas Dichtel wrote:
> > >> When this flag is set, it means that dump was interrupted and result may be
> > >> wrong. Ask user to restart.
> > >>
> > >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > >
> > >
> > > Do we have a guarantee this will complete eventually, on some hosts
> > > constantly adding removing entries ?
> > >
> > 
> > No. You mean it will be better to just print a warning and continue the dump?
> 
> I would not break the dump, return the indication, so that caller can
> chose to restart the loop one or two times.

Right, I would do it on an informal level at first. In fact libnl
will do an automatic restart of cache refills but I'm considering
to make it configurable for the application.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index f262959..91991cf 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -230,6 +230,12 @@  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) {
+					fprintf(stderr,
+						"Dump was interrupted, please restart.\n");
+					return -1;
+				}
+
 				if (h->nlmsg_type == NLMSG_DONE) {
 					found_done = 1;
 					break; /* process next filter */