Skip to contentSkip to conversation

src: add nfq_socket_sendto() - send config request and check response

PATCH New Duncan Roe 1 participant 2 messages Dec 11, 2023 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

cover src: add nfq_socket_sendto() - send config request and check response

Hi Pablo,

I had a static version of this in libnetfilter_queue.c for libnfnetlink replacement. Have already called it 4 times with at least 1 to go. Does make for more readable code.

Cheers ... Duncan.

Duncan Roe (1):
src: add nfq_socket_sendto() - send config request and check response

 .../libnetfilter_queue/libnetfilter_queue.h   |  2 +
 src/nlmsg.c                                   | 54 +++++++++++++------
 2 files changed, 41 insertions(+), 15 deletions(-)
Signature · 1 line
2.35.8
author
#1 lore raw

PATCH 1/1 src: add nfq_socket_sendto() - send config request and check response

Classic convenience function to complement nfq_nlmsg_put2().

---
 .../libnetfilter_queue/libnetfilter_queue.h   |  2 +
 src/nlmsg.c                                   | 54 +++++++++++++------
 2 files changed, 41 insertions(+), 15 deletions(-)
include/libnetfilter_queue/libnetfilter_queue.h +2 -0
index f7e68d8..724789a 100644
@@ -15,6 +15,7 @@
 
 #include <sys/time.h>
 #include <libnfnetlink/libnfnetlink.h>
+#include <libmnl/libmnl.h>
 
 #include <libnetfilter_queue/linux_nfnetlink_queue.h>
 
@@ -152,6 +153,7 @@ void nfq_nlmsg_verdict_put_pkt(struct nlmsghdr *nlh, const void *pkt, uint32_t p
 int nfq_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr **attr);
 struct nlmsghdr *nfq_nlmsg_put(char *buf, int type, uint32_t queue_num);
 struct nlmsghdr *nfq_nlmsg_put2(char *buf, int type, uint32_t queue_num, uint16_t flags);
+int nfq_socket_sendto(struct mnl_socket *nl, struct nlmsghdr *nlh, char *buf, unsigned int portid);
 
 #ifdef __cplusplus
 } /* extern "C" */
src/nlmsg.c +39 -15

74 lines not on this page · raw message

Signature · 1 line
2.35.8