netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_log] utils: nfulnl_test: Print meaningful error messages
@ 2021-09-08  8:48 Duncan Roe
  2021-09-20 11:46 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Duncan Roe @ 2021-09-08  8:48 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

e.g. "Operation not supported" when run as non-root

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 utils/nfulnl_test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/utils/nfulnl_test.c b/utils/nfulnl_test.c
index d888fc1..05ddc6c 100644
--- a/utils/nfulnl_test.c
+++ b/utils/nfulnl_test.c
@@ -58,38 +58,38 @@ int main(int argc, char **argv)
 
 	h = nflog_open();
 	if (!h) {
-		fprintf(stderr, "error during nflog_open()\n");
+		perror("nflog_open");
 		exit(1);
 	}
 
 	printf("unbinding existing nf_log handler for AF_INET (if any)\n");
 	if (nflog_unbind_pf(h, AF_INET) < 0) {
-		fprintf(stderr, "error nflog_unbind_pf()\n");
+		perror("nflog_unbind_pf");
 		exit(1);
 	}
 
 	printf("binding nfnetlink_log to AF_INET\n");
 	if (nflog_bind_pf(h, AF_INET) < 0) {
-		fprintf(stderr, "error during nflog_bind_pf()\n");
+		perror("nflog_bind_pf");
 		exit(1);
 	}
 	printf("binding this socket to group 0\n");
 	gh = nflog_bind_group(h, 0);
 	if (!gh) {
-		fprintf(stderr, "no handle for group 0\n");
+		perror("nflog_bind_group 0");
 		exit(1);
 	}
 
 	printf("binding this socket to group 100\n");
 	gh100 = nflog_bind_group(h, 100);
 	if (!gh100) {
-		fprintf(stderr, "no handle for group 100\n");
+		perror("nflog_bind_group 100");
 		exit(1);
 	}
 
 	printf("setting copy_packet mode\n");
 	if (nflog_set_mode(gh, NFULNL_COPY_PACKET, 0xffff) < 0) {
-		fprintf(stderr, "can't set packet copy mode\n");
+		perror("nflog_set_mode NFULNL_COPY_PACKET");
 		exit(1);
 	}
 
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH libnetfilter_log] utils: nfulnl_test: Print meaningful error messages
  2021-09-08  8:48 [PATCH libnetfilter_log] utils: nfulnl_test: Print meaningful error messages Duncan Roe
@ 2021-09-20 11:46 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-09-20 11:46 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Wed, Sep 08, 2021 at 06:48:35PM +1000, Duncan Roe wrote:
> e.g. "Operation not supported" when run as non-root

Also applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-20 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08  8:48 [PATCH libnetfilter_log] utils: nfulnl_test: Print meaningful error messages Duncan Roe
2021-09-20 11:46 ` Pablo Neira Ayuso

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).