netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Callback helpers

Functions

int mnl_cb_run2 (const void *buf, size_t numbytes, unsigned int seq, unsigned int portid, mnl_cb_t cb_data, void *data, mnl_cb_t *cb_ctl_array, unsigned int cb_ctl_array_len)
 mnl_cb_run2 - callback runqueue for netlink messages More...
 
 EXPORT_SYMBOL (mnl_cb_run2)
 
int mnl_cb_run (const void *buf, size_t numbytes, unsigned int seq, unsigned int portid, mnl_cb_t cb_data, void *data)
 mnl_cb_run - callback runqueue for netlink messages (simplified version) More...
 
 EXPORT_SYMBOL (mnl_cb_run)
 

Detailed Description

Function Documentation

EXPORT_SYMBOL ( mnl_cb_run2  )
EXPORT_SYMBOL ( mnl_cb_run  )
int mnl_cb_run ( const void *  buf,
size_t  numbytes,
unsigned int  seq,
unsigned int  portid,
mnl_cb_t  cb_data,
void *  data 
)

mnl_cb_run - callback runqueue for netlink messages (simplified version)

Parameters
bufbuffer that contains the netlink messages
numbytesnumber of bytes stored in the buffer
seqsequence number that we expect to receive
portidNetlink PortID that we expect to receive
cb_datacallback handler for data messages
datapointer to data that will be passed to the data callback handler

This function is like mnl_cb_run2() but it does not allow you to set the control callback handlers.

Your callback may return three possible values:

  • MNL_CB_ERROR (<=-1): an error has occurred. Stop callback runqueue.
  • MNL_CB_STOP (=0): stop callback runqueue.
  • MNL_CB_OK (>=1): no problems has occurred.

This function propagates the callback return value.

References NULL.

Referenced by handle_qacb(), mnl_batch_supported(), mnl_batch_talk(), mnl_talk(), nfct_mnl_talk(), nft_batch_is_supported(), nft_compatible_revision(), and xtables_events_main().

Here is the caller graph for this function:

int mnl_cb_run2 ( const void *  buf,
size_t  numbytes,
unsigned int  seq,
unsigned int  portid,
mnl_cb_t  cb_data,
void *  data,
mnl_cb_t cb_ctl_array,
unsigned int  cb_ctl_array_len 
)

mnl_cb_run2 - callback runqueue for netlink messages

Parameters
bufbuffer that contains the netlink messages
numbytesnumber of bytes stored in the buffer
seqsequence number that we expect to receive
portidNetlink PortID that we expect to receive
cb_datacallback handler for data messages
datapointer to data that will be passed to the data callback handler
cb_ctl_arrayarray of custom callback handlers from control messages
cb_ctl_array_lenarray length of custom control callback handlers

You can set the cb_ctl_array to NULL if you want to use the default control callback handlers, in that case, the parameter cb_ctl_array_len is not checked.

Your callback may return three possible values:

  • MNL_CB_ERROR (<=-1): an error has occurred. Stop callback runqueue.
  • MNL_CB_STOP (=0): stop callback runqueue.
  • MNL_CB_OK (>=1): no problem has occurred.

This function propagates the callback return value. On error, it returns -1 and errno is explicitly set. If the portID is not the expected, errno is set to ESRCH. If the sequence number is not the expected, errno is set to EPROTO. If the dump was interrupted, errno is set to EINTR and you should request a new fresh dump again.