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 to nflog_open()
  • pf β€” protocol family to bind to nflog handler obtained from nflog_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 to nflog_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

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 to nflog_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