diff options
author | Duncan Roe <duncan_roe@optusnet.com.au> | 2021-09-08 18:48:35 +1000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-09-20 13:45:44 +0200 |
commit | c01344adb10a356ab40ac870d601406b24c9c273 (patch) | |
tree | c4177fc10eef034d7cdddcf1cd108e56dbb8498f /utils | |
parent | a70dfaff5cf9f34100c48548dcc07e8e1ded64a6 (diff) |
utils: nfulnl_test: Print meaningful error messages
e.g. "Operation not supported" when run as non-root
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/nfulnl_test.c | 12 |
1 files 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); } |