diff mbox

[nft] mnl: continue monitor if errno is ESRCH

Message ID 20170226163058.24754-1-alexander@alemayhu.com
State Not Applicable
Delegated to: Pablo Neira
Headers show

Commit Message

Alexander Alemayhu Feb. 26, 2017, 4:30 p.m. UTC
Running the test cases in the shell directory while running nft monitor results
in nft exiting with '# ERROR: No such process'. The minimal steps where I could
reproduce is:

nft monitor # shell 1
run-tests.sh testcases/sets/0011add_many_elements_0 # shell 2

Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
---

Not sure if this is considered a fix or desired behaviour, but I was not
expecting monitor to exit like this.

 src/mnl.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Pablo Neira Ayuso Feb. 26, 2017, 8:24 p.m. UTC | #1
On Sun, Feb 26, 2017 at 05:30:58PM +0100, Alexander Alemayhu wrote:
> Running the test cases in the shell directory while running nft monitor results
> in nft exiting with '# ERROR: No such process'. The minimal steps where I could
> reproduce is:
> 
> nft monitor # shell 1
> run-tests.sh testcases/sets/0011add_many_elements_0 # shell 2
> 
> Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
> ---
> 
> Not sure if this is considered a fix or desired behaviour, but I was not
> expecting monitor to exit like this.
> 
>  src/mnl.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mnl.c b/src/mnl.c
> index 295dd84a5840..a0066a28b44f 100644
> --- a/src/mnl.c
> +++ b/src/mnl.c
> @@ -1129,7 +1129,10 @@ int mnl_nft_event_listener(struct mnl_socket *nf_sock,
>  				printf("# ERROR: We lost some netlink events!\n");
>  				continue;
>  			}
> +
>  			fprintf(stdout, "# ERROR: %s\n", strerror(errno));
> +			if (errno == ESRCH)
> +				continue;

It seems netlink is returning ESRCH when the number of events is high,
however, it should hit ENOBUFS instead, this is strange.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" 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/src/mnl.c b/src/mnl.c
index 295dd84a5840..a0066a28b44f 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -1129,7 +1129,10 @@  int mnl_nft_event_listener(struct mnl_socket *nf_sock,
 				printf("# ERROR: We lost some netlink events!\n");
 				continue;
 			}
+
 			fprintf(stdout, "# ERROR: %s\n", strerror(errno));
+			if (errno == ESRCH)
+				continue;
 			break;
 		}
 		ret = mnl_cb_run(buf, ret, 0, 0, cb, cb_data);