diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2013-03-26 22:15:35 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-03-27 13:57:46 +0100 |
commit | 260759dfdebe774aba6866bf49c2928b2242bb7e (patch) | |
tree | 8fa890f6fe0f84aefef3c94d4f02cb21400bc957 | |
parent | 11cb82355dee90e23ee5ddc3030c48b117c3fe29 (diff) |
callback: fix missing handling of NLM_F_DUMP_INTR
Propagate the error to the user-space application, that should retry.
[ I have mangled this patch to document EINTR in mnl_cb_run. --pablo ]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | src/callback.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/callback.c b/src/callback.c index 6337acc..f023401 100644 --- a/src/callback.c +++ b/src/callback.c @@ -65,6 +65,12 @@ __mnl_cb_run(const void *buf, size_t numbytes, unsigned int seq, return -1; } + /* dump was interrupted */ + if (nlh->nlmsg_flags & NLM_F_DUMP_INTR) { + errno = EINTR; + return -1; + } + /* netlink data message handling */ if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) { if (cb_data){ @@ -117,7 +123,8 @@ out: * This function propagates the callback return value. On error, it returns * -1 and errno is explicitly set. If the portID is not the expected, errno * is set to ESRCH. If the sequence number is not the expected, errno is set - * to EPROTO. + * to EPROTO. If the dump was interrupted, errno is set to EINTR and you should + * request a new fresh dump again. */ int mnl_cb_run2(const void *buf, size_t numbytes, unsigned int seq, |