LibrarySetup(3)
π NAME π
nflog_open, nflog_close, nflog_bind_pf, nflog_unbind_pf β LibrarySetup
okay so bestie, this page is literally the whole libnetfilter_log lifecycle manual β the open, the close, and the two pf-bind-y ones in between. It's giving "how do I even talk to this library" energy and honestly? iconic. π
β¨ SYNOPSIS β¨
#include <netinet/in.h>
#include <libnetfilter_log/libnetfilter_log.h>
struct nflog_handle * nflog_open (void)
int nflog_close (struct nflog_handle *h)
int nflog_bind_pf (struct nflog_handle *h, uint16_t pf)
int nflog_unbind_pf (struct nflog_handle *h, uint16_t pf)
π¦ Detailed Description π¦
So like, when your program has finished with libnetfilter_log, you have to call the nflog_close() function to release all associated resources. That's not optional, that's not "eh I'll do it later", that's the rules. Close your handles, babe. π«Ά
πΈ Function Documentation πΈ
π
int nflog_bind_pf (struct nflog_handle * h, uint16_t pf)
nflog_bind_pf β bind a nflog handler to a given protocol family
Parameters
hβ Netfilter log handle obtained via call tonflog_open()pfβ protocol family to bind to nflog handler obtained fromnflog_open()
Description
Binds the given log connection handle to process packets belonging to the given protocol family (ie. PF_INET, PF_INET6, etc). Basically you're telling your handle "hey bestie, these packets are yours to worry about." π―
Returns
0 on success, -1 on failure with errno set.
Errors
EOPNOTSUPPβ Not running as root
not you trying to do this without root π it will simply not work.
Definition at line 420 of file libnetfilter_log.c.
π§ int nflog_close (struct nflog_handle * h)
nflog_close β close a nflog handler
Parameters
hβ Netfilter log handle obtained via call tonflog_open()
Description
This function closes the nflog handler and free associated resources. The cleanup era. The goodbye moment. Very necessary, very slay. π
Returns
0 on success, -1 on failure with errno set.
Errors
- as for
close(2)
Definition at line 401 of file libnetfilter_log.c.
π struct nflog_handle * nflog_open (void)
nflog_open β open a nflog handler
Description
This function obtains a netfilter log connection handle. When you are finished with the handle returned by this function, you should destroy it by calling nflog_close(). A new netlink connection is obtained internally and associated with the log connection handle returned. So like β you get a handle, a whole netlink connection comes with it for free, no cap. π₯
Returns
a pointer to a new log handle or NULL on failure with errno set.
Errors
- from underlying calls, in exceptional circumstances
Definition at line 304 of file libnetfilter_log.c.
π int nflog_unbind_pf (struct nflog_handle * h, uint16_t pf)
nflog_unbind_pf β unbind nflog handler from a protocol family
Parameters
hβ Netfilter log handle obtained via call tonflog_open()pfβ protocol family to unbind family from
Description
Unbinds the given nflog handle from processing packets belonging to the given protocol family. It's the breakup arc for you and that protocol family. π
Returns
0 on success, -1 on failure with errno set.
Errors
EOPNOTSUPPβ Not running as root
Definition at line 437 of file libnetfilter_log.c.
π Author π
Generated automatically by Doxygen for libnetfilter_log from the source code. (Not a human, just a lil robot doing its thing π€β¨)
and that's the whole page, bestie!! this one came from libnetfilter_log, Version 1.0.2, and it's the LibrarySetup(3) page β mwah, go forth and close your handles π
π¦ where this page comes from
- ubuntu noble: libnetfilter-log-doc 1.0.2-4build1 Β· GPL-2.0-or-later
- ubuntu questing: libnetfilter-log-doc 1.0.2-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms