From: Duncan Roe <duncan_roe@optusnet.com.au>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH libnetfilter_queue] utils: Add example of setting socket buffer size
Date: Fri, 10 Nov 2023 15:16:04 +1100 [thread overview]
Message-ID: <20231110041604.11564-1-duncan_roe@optusnet.com.au> (raw)
The libnetfilter_queue main HTML page mentions nfnl_rcvbufsiz() so the new
libmnl-only libnetfilter_queue will have to support it.
The added call acts as a demo and a test case.
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
utils/nfqnl_test.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c
index 682f3d7..6d2305e 100644
--- a/utils/nfqnl_test.c
+++ b/utils/nfqnl_test.c
@@ -91,6 +91,7 @@ int main(int argc, char **argv)
int fd;
int rv;
uint32_t queue = 0;
+ uint32_t ret;
char buf[4096] __attribute__ ((aligned));
if (argc == 2) {
@@ -107,6 +108,10 @@ int main(int argc, char **argv)
fprintf(stderr, "error during nfq_open()\n");
exit(1);
}
+ printf("setting socket buffer size to 2MB\n");
+ ret = nfnl_rcvbufsiz(nfq_nfnlh(h), 1024 * 1024);
+ printf("Read buffer set to 0x%x bytes (%gMB)\n", ret,
+ ret / 1024.0 / 1024);
printf("unbinding existing nf_queue handler for AF_INET (if any)\n");
if (nfq_unbind_pf(h, AF_INET) < 0) {
--
2.35.8
next reply other threads:[~2023-11-10 19:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 4:16 Duncan Roe [this message]
2023-11-14 15:22 ` [PATCH libnetfilter_queue] utils: Add example of setting socket buffer size Pablo Neira Ayuso
2023-11-15 7:56 ` Duncan Roe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231110041604.11564-1-duncan_roe@optusnet.com.au \
--to=duncan_roe@optusnet.com.au \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.