conntrack: Allow setting of netlink buffer size
PATCH 1/1 conntrack: Allow setting of netlink buffer size
ENOBUFS is returned in the case that the nfnetlink socket buffer is exhausted. The function nfnl_rcvbufsize is provided by libnfnetlink to set the buffer size in order to handle this error, however libnetfilter_conntrack does not expose this function for the underlying netlink socket.
Add nfct_rcvbufsiz function to allow setting of buffer size for netlink socket.
--- .../libnetfilter_conntrack.h | 3 +++ src/conntrack/api.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)
include/libnetfilter_conntrack/libnetfilter_conntrack.h +3 -0
@@ -591,6 +591,9 @@ extern int nfct_nlmsg_build_filter(struct nlmsghdr *nlh, const struct nfct_filteextern int nfct_nlmsg_parse (const struct nlmsghdr *nlh,struct nf_conntrack *ct);extern int nfct_payload_parse (const void *payload,size_t payload_len,uint16_t l3num,struct nf_conntrack *ct); +/* set size of netlink socket buffer */ +unsigned int nfct_rcvbufsize (struct nfct_handle *h,unsigned int size); +/* * NEW expectation API */
src/conntrack/api.c +18 -0
@@ -350,6 +350,24 @@ void nfct_callback_unregister2(struct nfct_handle *h) h->nfnl_cb_ct.attr_count =0 ; } +/** +* nfct_rcvbufsiz - set size of netlink socket buffer +* \param h library handler +* \param size size of the buffer we want to set +* +* This function sets the new size of the the netlink socket buffer. Use this +* setting to increase the socket buffer size if your system is reporting +* ENOBUFS errors. +* +* This function returns the new size of the netlink socket buffer. +*/ +unsigned int nfct_rcvbufsiz (struct nfct_handle *h,unsigned int size) +{ +assert (h !=NULL ); + +return nfnl_rcvbufsiz (h->nfnlh, size); +} +/** * @} */
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerQuoted 8 lines · William Blough
ENOBUFS is returned in the case that the nfnetlink socket buffer is exhausted. The function
nfnl_rcvbufsizeis provided by libnfnetlink to set the buffer size in order to handle this error, howeverlibnetfilter_conntrackdoes not expose this function for the underlying netlink socket.Add
nfct_rcvbufsizfunction to allow setting of buffer size for netlink socket.
Thanks for your patch.
There is already nfct_fd() and you can use setsockopt() on it.
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · William Blough
Add
nfct_rcvbufsizfunction to allow setting of buffer size for netlink socket.Thanks for your patch.
There is already
nfct_fd()and you can usesetsockopt()on it.
Ah, apparently I overlooked that. Thanks.
Best regards,
Bill