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

Netlink message: More...

Collaboration diagram for Netlink message helpers:

Modules

 Netlink message batch helpers
 This library provides helpers to batch several messages into one single datagram.
 

Data Structures

struct  _container_policy_cb
 

Functions

size_t mnl_nlmsg_size (size_t len)
 mnl_nlmsg_size - calculate the size of Netlink message (without alignment) More...
 
 EXPORT_SYMBOL (mnl_nlmsg_size)
 
size_t mnl_nlmsg_get_payload_len (const struct nlmsghdr *nlh)
 mnl_nlmsg_get_payload_len - get the length of the Netlink payload More...
 
 EXPORT_SYMBOL (mnl_nlmsg_get_payload_len)
 
struct nlmsghdrmnl_nlmsg_put_header (void *buf)
 mnl_nlmsg_put_header - reserve and prepare room for Netlink header More...
 
 EXPORT_SYMBOL (mnl_nlmsg_put_header)
 
void * mnl_nlmsg_put_extra_header (struct nlmsghdr *nlh, size_t size)
 mnl_nlmsg_put_extra_header - reserve and prepare room for an extra header More...
 
 EXPORT_SYMBOL (mnl_nlmsg_put_extra_header)
 
void * mnl_nlmsg_get_payload (const struct nlmsghdr *nlh)
 mnl_nlmsg_get_payload - get a pointer to the payload of the netlink message More...
 
 EXPORT_SYMBOL (mnl_nlmsg_get_payload)
 
void * mnl_nlmsg_get_payload_offset (const struct nlmsghdr *nlh, size_t offset)
 mnl_nlmsg_get_payload_offset - get a pointer to the payload of the message More...
 
 EXPORT_SYMBOL (mnl_nlmsg_get_payload_offset)
 
bool mnl_nlmsg_ok (const struct nlmsghdr *nlh, int len)
 mnl_nlmsg_ok - check a there is room for netlink message More...
 
 EXPORT_SYMBOL (mnl_nlmsg_ok)
 
struct nlmsghdrmnl_nlmsg_next (const struct nlmsghdr *nlh, int *len)
 mnl_nlmsg_next - get the next netlink message in a multipart message More...
 
 EXPORT_SYMBOL (mnl_nlmsg_next)
 
void * mnl_nlmsg_get_payload_tail (const struct nlmsghdr *nlh)
 mnl_nlmsg_get_payload_tail - get the ending of the netlink message More...
 
 EXPORT_SYMBOL (mnl_nlmsg_get_payload_tail)
 
bool mnl_nlmsg_seq_ok (const struct nlmsghdr *nlh, unsigned int seq)
 mnl_nlmsg_seq_ok - perform sequence tracking More...
 
 EXPORT_SYMBOL (mnl_nlmsg_seq_ok)
 
bool mnl_nlmsg_portid_ok (const struct nlmsghdr *nlh, unsigned int portid)
 mnl_nlmsg_portid_ok - perform portID origin check More...
 
 EXPORT_SYMBOL (mnl_nlmsg_portid_ok)
 
void mnl_nlmsg_fprintf (FILE *fd, const void *data, size_t datalen, size_t extra_header_size)
 mnl_nlmsg_fprintf - print netlink message to file More...
 
 EXPORT_SYMBOL (mnl_nlmsg_fprintf)
 
struct nlmsghdrnfacct_nlmsg_build_hdr (char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 nfacct_nlmsg_build_hdr - build netlink message header for nfacct subsystem More...
 
 EXPORT_SYMBOL (nfacct_nlmsg_build_hdr)
 
void nfacct_nlmsg_build_payload (struct nlmsghdr *nlh, struct nfacct *nfacct)
 nfacct_nlmsg_build_payload - build payload from accounting object More...
 
 EXPORT_SYMBOL (nfacct_nlmsg_build_payload)
 
int nfacct_nlmsg_parse_payload (const struct nlmsghdr *nlh, struct nfacct *nfacct)
 nfacct_nlmsg_parse_payload - set accounting object attributes from message More...
 
 EXPORT_SYMBOL (nfacct_nlmsg_parse_payload)
 
struct nlmsghdrnfct_helper_nlmsg_build_hdr (char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 nfct_helper_nlmsg_build_hdr - build netlink message header for nfct_helper subsystem More...
 
 EXPORT_SYMBOL (nfct_helper_nlmsg_build_hdr)
 
void nfct_helper_nlmsg_build_payload (struct nlmsghdr *nlh, struct nfct_helper *h)
 nfct_helper_nlmsg_build_payload - build payload from helper object More...
 
 EXPORT_SYMBOL (nfct_helper_nlmsg_build_payload)
 
int nfct_helper_nlmsg_parse_payload (const struct nlmsghdr *nlh, struct nfct_helper *h)
 nfct_helper_nlmsg_parse_payload - set helper object attributes from message More...
 
 EXPORT_SYMBOL (nfct_helper_nlmsg_parse_payload)
 
struct nlmsghdrnfct_timeout_nlmsg_build_hdr (char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 nfct_timeout_nlmsg_build_hdr - build netlink message header for ct timeout More...
 
 EXPORT_SYMBOL (nfct_timeout_nlmsg_build_hdr)
 
void nfct_timeout_nlmsg_build_payload (struct nlmsghdr *nlh, const struct nfct_timeout *t)
 nfct_timeout_nlmsg_build_payload - build payload from ct timeout object More...
 
 EXPORT_SYMBOL (nfct_timeout_nlmsg_build_payload)
 
int nfct_timeout_nlmsg_parse_payload (const struct nlmsghdr *nlh, struct nfct_timeout *t)
 nfct_timeout_nlmsg_parse_payload - set timeout object attributes from message More...
 
 EXPORT_SYMBOL (nfct_timeout_nlmsg_parse_payload)
 
int nfq_nlmsg_parse (const struct nlmsghdr *nlh, struct nlattr **attr)
 nfq_pkt_parse - set packet attributes from netlink message More...
 
 EXPORT_SYMBOL (nfq_nlmsg_parse)
 

Variables

void * mnl_nlmsg_batch::buf
 
size_t mnl_nlmsg_batch::limit
 
size_t mnl_nlmsg_batch::buflen
 
void * mnl_nlmsg_batch::cur
 
bool mnl_nlmsg_batch::overflow
 

Detailed Description

Netlink message:

    |<----------------- 4 bytes ------------------->|
    |<----- 2 bytes ------>|<------- 2 bytes ------>|
    |-----------------------------------------------|
    |      Message length (including header)        |
    |-----------------------------------------------|
    |     Message type     |     Message flags      |
    |-----------------------------------------------|
    |           Message sequence number             |
    |-----------------------------------------------|
    |                 Netlink PortID                |
    |-----------------------------------------------|
    |                                               |
    .                   Payload                     .
    |_______________________________________________|

There is usually an extra header after the the Netlink header (at the beginning of the payload). This extra header is specific of the Netlink subsystem. After this extra header, it comes the sequence of attributes that are expressed in Type-Length-Value (TLV) format.

Function Documentation

EXPORT_SYMBOL ( mnl_nlmsg_size  )
EXPORT_SYMBOL ( mnl_nlmsg_get_payload_len  )
EXPORT_SYMBOL ( mnl_nlmsg_put_header  )
EXPORT_SYMBOL ( mnl_nlmsg_put_extra_header  )
EXPORT_SYMBOL ( mnl_nlmsg_get_payload  )
EXPORT_SYMBOL ( mnl_nlmsg_get_payload_offset  )
EXPORT_SYMBOL ( mnl_nlmsg_ok  )
EXPORT_SYMBOL ( nfq_nlmsg_parse  )
EXPORT_SYMBOL ( mnl_nlmsg_next  )
EXPORT_SYMBOL ( mnl_nlmsg_get_payload_tail  )
EXPORT_SYMBOL ( mnl_nlmsg_seq_ok  )
EXPORT_SYMBOL ( mnl_nlmsg_portid_ok  )
EXPORT_SYMBOL ( mnl_nlmsg_fprintf  )
EXPORT_SYMBOL ( nfacct_nlmsg_build_hdr  )
EXPORT_SYMBOL ( nfacct_nlmsg_build_payload  )
EXPORT_SYMBOL ( nfct_timeout_nlmsg_build_hdr  )
EXPORT_SYMBOL ( nfct_helper_nlmsg_build_hdr  )
EXPORT_SYMBOL ( nfct_timeout_nlmsg_build_payload  )
EXPORT_SYMBOL ( nfacct_nlmsg_parse_payload  )
EXPORT_SYMBOL ( nfct_helper_nlmsg_build_payload  )
EXPORT_SYMBOL ( nfct_timeout_nlmsg_parse_payload  )
EXPORT_SYMBOL ( nfct_helper_nlmsg_parse_payload  )
void mnl_nlmsg_fprintf ( FILE *  fd,
const void *  data,
size_t  datalen,
size_t  extra_header_size 
)

mnl_nlmsg_fprintf - print netlink message to file

Parameters
fdpointer to file type
datapointer to the buffer that contains messages to be printed
datalenlength of data stored in the buffer
extra_header_sizesize of the extra header (if any)

This function prints the netlink header to a file handle. It may be useful for debugging purposes. One example of the output is the following:

----------------        ------------------
|  0000000040  |        | message length |
| 00016 | R-A- |        |  type | flags  |
|  1289148991  |        | sequence number|
|  0000000000  |        |     port ID    |
----------------        ------------------
| 00 00 00 00  |        |  extra header  |
| 00 00 00 00  |        |  extra header  |
| 01 00 00 00  |        |  extra header  |
| 01 00 00 00  |        |  extra header  |
|00008|--|00003|        |len |flags| type|
| 65 74 68 30  |        |      data      |       e t h 0
----------------        ------------------

This example above shows the netlink message that is send to kernel-space to set up the link interface eth0. The netlink and attribute header data are displayed in base 10 whereas the extra header and the attribute payload are expressed in base 16. The possible flags in the netlink header are:

  • R, that indicates that NLM_F_REQUEST is set.
  • M, that indicates that NLM_F_MULTI is set.
  • A, that indicates that NLM_F_ACK is set.
  • E, that indicates that NLM_F_ECHO is set.

The lack of one flag is displayed with '-'. On the other hand, the possible attribute flags available are:

  • N, that indicates that NLA_F_NESTED is set.
  • B, that indicates that NLA_F_NET_BYTEORDER is set.

References data, datalen, len, mnl_nlmsg_next(), and mnl_nlmsg_ok().

Referenced by nft_chain_add(), and nft_table_add().

Here is the call graph for this function:

Here is the caller graph for this function:

void* mnl_nlmsg_get_payload ( const struct nlmsghdr nlh)

mnl_nlmsg_get_payload - get a pointer to the payload of the netlink message

Parameters
nlhpointer to a netlink header

This function returns a pointer to the payload of the netlink message.

References MNL_NLMSG_HDRLEN.

Referenced by ipset_debug_msg(), nfacct_nlmsg_parse_payload(), nfct_helper_nlmsg_parse_payload(), nfct_nlmsg_parse(), nfct_timeout_nlmsg_parse_payload(), nfexp_nlmsg_parse(), nft_chain_nlmsg_parse(), nft_gen_nlmsg_parse(), nft_rule_nlmsg_parse(), nft_set_elems_nlmsg_parse(), nft_set_nlmsg_parse(), and nft_table_nlmsg_parse().

Here is the caller graph for this function:

size_t mnl_nlmsg_get_payload_len ( const struct nlmsghdr nlh)

mnl_nlmsg_get_payload_len - get the length of the Netlink payload

Parameters
nlhpointer to the header of the Netlink message

This function returns the Length of the netlink payload, ie. the length of the full message minus the size of the Netlink header.

References MNL_NLMSG_HDRLEN, and nlmsghdr::nlmsg_len.

Referenced by nfct_nlmsg_parse().

Here is the caller graph for this function:

void* mnl_nlmsg_get_payload_offset ( const struct nlmsghdr nlh,
size_t  offset 
)

mnl_nlmsg_get_payload_offset - get a pointer to the payload of the message

Parameters
nlhpointer to a netlink header
offsetoffset to the payload of the attributes TLV set

This function returns a pointer to the payload of the netlink message plus a given offset.

References MNL_ALIGN, and MNL_NLMSG_HDRLEN.

void* mnl_nlmsg_get_payload_tail ( const struct nlmsghdr nlh)

mnl_nlmsg_get_payload_tail - get the ending of the netlink message

Parameters
nlhpointer to netlink message

This function returns a pointer to the netlink message tail. This is useful to build a message since we continue adding attributes at the end of the message.

References MNL_ALIGN, and nlmsghdr::nlmsg_len.

Referenced by mnl_attr_nest_cancel(), mnl_attr_nest_end(), mnl_attr_nest_start(), and mnl_attr_put().

Here is the caller graph for this function:

struct nlmsghdr* mnl_nlmsg_next ( const struct nlmsghdr nlh,
int *  len 
)

mnl_nlmsg_next - get the next netlink message in a multipart message

Parameters
nlhcurrent netlink message that we are handling
lenlength of the remaining bytes in the buffer (passed by reference).

This function returns a pointer to the next netlink message that is part of a multi-part netlink message. Netlink can batch several messages into one buffer so that the receiver has to iterate over the whole set of Netlink messages.

You have to use mnl_nlmsg_ok() to check if the next Netlink message is valid.

References MNL_ALIGN, and nlmsghdr::nlmsg_len.

Referenced by ipset_debug_msg(), and mnl_nlmsg_fprintf().

Here is the caller graph for this function:

bool mnl_nlmsg_ok ( const struct nlmsghdr nlh,
int  len 
)

mnl_nlmsg_ok - check a there is room for netlink message

Parameters
nlhnetlink message that we want to check
lenremaining bytes in a buffer that contains the netlink message

This function is used to check that a buffer that contains a netlink message has enough room for the netlink message that it stores, ie. this function can be used to verify that a netlink message is not malformed nor truncated.

This function does not set errno in case of error since it is intended for iterations. Thus, it returns true on success and false on error.

The len parameter may become negative in malformed messages during message iteration, that is why we use a signed integer.

References nlmsghdr::nlmsg_len.

Referenced by ipset_debug_msg(), and mnl_nlmsg_fprintf().

Here is the caller graph for this function:

bool mnl_nlmsg_portid_ok ( const struct nlmsghdr nlh,
unsigned int  portid 
)

mnl_nlmsg_portid_ok - perform portID origin check

Parameters
nlhcurrent netlink message that we are handling
portidnetlink portid that we want to check

This functions returns true if the origin is fulfilled, otherwise false is returned. We skip the tracking for netlink message whose portID is zero since it is reserved for event-based kernel notifications. On the other hand, if portid is set but the message PortID is not (i.e. this is an event message coming from kernel-space), then we also skip the tracking. This approach is good if we use the same socket to send commands to kernel-space (that we want to track) and to listen to events (that we do not track).

References nlmsghdr::nlmsg_pid.

void* mnl_nlmsg_put_extra_header ( struct nlmsghdr nlh,
size_t  size 
)

mnl_nlmsg_put_extra_header - reserve and prepare room for an extra header

Parameters
nlhpointer to Netlink header
sizesize of the extra header that we want to put

This function sets to zero the room that is required to put the extra header after the initial Netlink header. This function also increases the nlmsg_len field. You have to invoke mnl_nlmsg_put_header() before you call this function. This function returns a pointer to the extra header.

References len, MNL_ALIGN, and nlmsghdr::nlmsg_len.

Referenced by nfacct_nlmsg_build_hdr(), nfct_helper_nlmsg_build_hdr(), nfct_timeout_nlmsg_build_hdr(), nft_compatible_revision(), and nft_nlmsg_build_hdr().

Here is the caller graph for this function:

struct nlmsghdr* mnl_nlmsg_put_header ( void *  buf)

mnl_nlmsg_put_header - reserve and prepare room for Netlink header

Parameters
bufmemory already allocated to store the Netlink header

This function sets to zero the room that is required to put the Netlink header in the memory buffer passed as parameter. This function also initializes the nlmsg_len field to the size of the Netlink header. This function returns a pointer to the Netlink header structure.

References buf, len, MNL_ALIGN, nlh, and nlmsghdr::nlmsg_len.

Referenced by nfacct_nlmsg_build_hdr(), nfct_helper_nlmsg_build_hdr(), nfct_timeout_nlmsg_build_hdr(), nft_compatible_revision(), and nft_nlmsg_build_hdr().

Here is the caller graph for this function:

bool mnl_nlmsg_seq_ok ( const struct nlmsghdr nlh,
unsigned int  seq 
)

mnl_nlmsg_seq_ok - perform sequence tracking

Parameters
nlhcurrent netlink message that we are handling
seqlast sequence number used to send a message

This functions returns true if the sequence tracking is fulfilled, otherwise false is returned. We skip the tracking for netlink messages whose sequence number is zero since it is usually reserved for event-based kernel notifications. On the other hand, if seq is set but the message sequence number is not set (i.e. this is an event message coming from kernel-space), then we also skip the tracking. This approach is good if we use the same socket to send commands to kernel-space (that we want to track) and to listen to events (that we do not track).

References nlmsghdr::nlmsg_seq.

size_t mnl_nlmsg_size ( size_t  len)

mnl_nlmsg_size - calculate the size of Netlink message (without alignment)

Parameters
lenlength of the Netlink payload

This function returns the size of a netlink message (header plus payload) without alignment.

References MNL_NLMSG_HDRLEN.

struct nlmsghdr* nfacct_nlmsg_build_hdr ( char *  buf,
uint8_t  cmd,
uint16_t  flags,
uint32_t  seq 
)

nfacct_nlmsg_build_hdr - build netlink message header for nfacct subsystem

Parameters
bufbuffer where this function outputs the netlink message.
cmdnfacct nfnetlink command.
flagsnetlink flags.
seqsequence number for this message.

Possible commands:

  • NFNL_MSG_ACCT_NEW: new accounting object.
  • NFNL_MSG_ACCT_GET: get accounting object.
  • NFNL_MSG_ACCT_GET_CTRZERO: get accounting object and atomically reset.

Examples:

  • Command NFNL_MSG_ACCT_NEW + flags NLM_F_CREATE | NLM_F_ACK, to create one new accounting object (if it does not already exists). You receive one acknoledgment in any case with the result of the operation.
  • Command NFNL_MSG_ACCT_GET + flags NLM_F_DUMP, to obtain all the existing accounting objects.
  • Command NFNL_MSG_ACCT_GET_CTRZERO + flags NLM_F_DUMP, to atomically obtain all the existing accounting objects and reset them.
  • Command NFNL_MSG_ACCT_DEL, to delete all existing unused objects.
  • Command NFNL_MSG_ACCT_DEL, to delete one specific nfacct object (if unused, otherwise you hit EBUSY).

References flags, mnl_nlmsg_put_extra_header(), mnl_nlmsg_put_header(), nfgenmsg::nfgen_family, NFNETLINK_V0, NFNL_SUBSYS_ACCT, nlh, NLM_F_REQUEST, nlmsghdr::nlmsg_flags, nlmsghdr::nlmsg_seq, nlmsghdr::nlmsg_type, nfgenmsg::res_id, and nfgenmsg::version.

Here is the call graph for this function:

void nfacct_nlmsg_build_payload ( struct nlmsghdr nlh,
struct nfacct nfacct 
)

nfacct_nlmsg_build_payload - build payload from accounting object

Parameters
nlhnetlink message that you want to use to add the payload.
nfacctpointer to a accounting object

References nfacct::bitset, nfacct::bytes, nfacct::flags, htobe64, mnl_attr_put_strz(), mnl_attr_put_u32(), mnl_attr_put_u64(), nfacct::name, NFACCT_ATTR_BYTES, NFACCT_ATTR_FLAGS, NFACCT_ATTR_NAME, NFACCT_ATTR_PKTS, NFACCT_ATTR_QUOTA, NFACCT_BYTES, NFACCT_FLAGS, NFACCT_NAME, NFACCT_PKTS, NFACCT_QUOTA, nfacct::pkts, and nfacct::quota.

Here is the call graph for this function:

int nfacct_nlmsg_parse_payload ( const struct nlmsghdr nlh,
struct nfacct nfacct 
)

nfacct_nlmsg_parse_payload - set accounting object attributes from message

Parameters
nlhnetlink message that you want to use to add the payload.
nfacctpointer to a accounting object

This function returns -1 in case that some mandatory attributes are missing. On sucess, it returns 0.

References be64toh, mnl_attr_get_str(), mnl_attr_get_u32(), mnl_attr_get_u64(), mnl_attr_parse(), mnl_nlmsg_get_payload(), NFACCT_ATTR_BYTES, NFACCT_ATTR_FLAGS, NFACCT_ATTR_NAME, NFACCT_ATTR_PKTS, NFACCT_ATTR_QUOTA, nfacct_attr_set(), nfacct_attr_set_str(), nfacct_attr_set_u64(), NFACCT_BYTES, NFACCT_FLAGS, NFACCT_MAX, NFACCT_NAME, NFACCT_PKTS, and NFACCT_QUOTA.

Here is the call graph for this function:

struct nlmsghdr* nfct_helper_nlmsg_build_hdr ( char *  buf,
uint8_t  cmd,
uint16_t  flags,
uint32_t  seq 
)

nfct_helper_nlmsg_build_hdr - build netlink message header for nfct_helper subsystem

Parameters
bufbuffer where this function outputs the netlink message.
cmdnfct_helper nfnetlink command.
flagsnetlink flags.
seqsequence number for this message.

Possible commands:

  • NFNL_MSG_ACCT_NEW: new helper object.
  • NFNL_MSG_ACCT_GET: get helper object.
  • NFNL_MSG_ACCT_GET_CTRZERO: get helper object and atomically reset.

Examples:

  • Command NFNL_MSG_ACCT_NEW + flags NLM_F_CREATE | NLM_F_ACK, to create one new helper object (if it does not already exists). You receive one acknoledgment in any case with the result of the operation.
  • Command NFNL_MSG_ACCT_GET + flags NLM_F_DUMP, to obtain all the existing helper objects.
  • Command NFNL_MSG_ACCT_DEL, to delete all existing unused objects.
  • Command NFNL_MSG_ACCT_DEL, to delete one specific nfct_helper object (if unused, otherwise you hit EBUSY).

References flags, mnl_nlmsg_put_extra_header(), mnl_nlmsg_put_header(), nfgenmsg::nfgen_family, NFNETLINK_V0, NFNL_SUBSYS_CTHELPER, nlh, NLM_F_REQUEST, nlmsghdr::nlmsg_flags, nlmsghdr::nlmsg_seq, nlmsghdr::nlmsg_type, nfgenmsg::res_id, and nfgenmsg::version.

Here is the call graph for this function:

int nfct_helper_nlmsg_parse_payload ( const struct nlmsghdr nlh,
struct nfct_helper h 
)

nfct_helper_nlmsg_parse_payload - set helper object attributes from message

Parameters
nlhnetlink message that you want to use to add the payload.
nfct_helperpointer to a helper object

This function returns -1 in case that some mandatory attributes are missing. On sucess, it returns 0.

References mnl_attr_get_str(), mnl_attr_get_u32(), mnl_attr_parse(), mnl_nlmsg_get_payload(), nfct_helper_attr_set_str(), nfct_helper_attr_set_u32(), NFCTH_ATTR_NAME, NFCTH_ATTR_PRIV_DATA_LEN, NFCTH_ATTR_QUEUE_NUM, NFCTH_ATTR_STATUS, NFCTH_MAX, NFCTH_NAME, NFCTH_POLICY, NFCTH_PRIV_DATA_LEN, NFCTH_QUEUE_NUM, NFCTH_STATUS, and NFCTH_TUPLE.

Here is the call graph for this function:

struct nlmsghdr* nfct_timeout_nlmsg_build_hdr ( char *  buf,
uint8_t  cmd,
uint16_t  flags,
uint32_t  seq 
)

nfct_timeout_nlmsg_build_hdr - build netlink message header for ct timeout

Parameters
bufbuffer where this function outputs the netlink message.
cmdnfct_timeout nfnetlink command.
flagsnetlink flags.
seqsequence number for this message.

Possible commands:

  • CTNL_MSG_TIMEOUT_NEW: new conntrack timeout object.
  • CTNL_MSG_TIMEOUT_GET: get conntrack timeout object.
  • CTNL_MSG_TIMEOUT_DEL: delete conntrack timeout object.

References flags, mnl_nlmsg_put_extra_header(), mnl_nlmsg_put_header(), nfgenmsg::nfgen_family, NFNETLINK_V0, NFNL_SUBSYS_CTNETLINK_TIMEOUT, nlh, NLM_F_REQUEST, nlmsghdr::nlmsg_flags, nlmsghdr::nlmsg_seq, nlmsghdr::nlmsg_type, nfgenmsg::res_id, and nfgenmsg::version.

Here is the call graph for this function:

void nfct_timeout_nlmsg_build_payload ( struct nlmsghdr nlh,
const struct nfct_timeout t 
)

nfct_timeout_nlmsg_build_payload - build payload from ct timeout object

Parameters
nlhnetlink message that you want to use to add the payload.
tpointer to a conntrack timeout object

References nfct_timeout::attrset, CTA_TIMEOUT_DATA, CTA_TIMEOUT_L3PROTO, CTA_TIMEOUT_L4PROTO, CTA_TIMEOUT_NAME, nfct_timeout::l3num, nfct_timeout::l4num, mnl_attr_nest_end(), mnl_attr_nest_start(), mnl_attr_put_strz(), mnl_attr_put_u16(), mnl_attr_put_u32(), mnl_attr_put_u8(), nfct_timeout::name, NFCT_TIMEOUT_ATTR_L3PROTO, NFCT_TIMEOUT_ATTR_L4PROTO, NFCT_TIMEOUT_ATTR_NAME, NFCT_TIMEOUT_ATTR_POLICY, nfct_timeout::polset, and nfct_timeout::timeout.

Here is the call graph for this function:

int nfct_timeout_nlmsg_parse_payload ( const struct nlmsghdr nlh,
struct nfct_timeout t 
)

nfct_timeout_nlmsg_parse_payload - set timeout object attributes from message

Parameters
nlhnetlink message that you want to use to add the payload.
tpointer to a conntrack timeout object

This function returns -1 in case that some mandatory attributes are missing. On sucess, it returns 0.

References CTA_TIMEOUT_DATA, CTA_TIMEOUT_L3PROTO, CTA_TIMEOUT_L4PROTO, CTA_TIMEOUT_MAX, CTA_TIMEOUT_NAME, mnl_attr_get_str(), mnl_attr_get_u16(), mnl_attr_get_u8(), mnl_attr_parse(), mnl_nlmsg_get_payload(), NFCT_TIMEOUT_ATTR_L3PROTO, NFCT_TIMEOUT_ATTR_L4PROTO, NFCT_TIMEOUT_ATTR_NAME, nfct_timeout_attr_set(), nfct_timeout_attr_set_u16(), and nfct_timeout_attr_set_u8().

Here is the call graph for this function:

int nfq_nlmsg_parse ( const struct nlmsghdr nlh,
struct nlattr **  attr 
)

nfq_pkt_parse - set packet attributes from netlink message

Parameters
nlhnetlink message that you want to read.
pktpointer to the packet to set.

This function returns MNL_CB_ERROR if any error occurs, or MNL_CB_OK on success.

References mnl_attr_parse().

Here is the call graph for this function:

Variable Documentation

size_t mnl_nlmsg_batch::limit
bool mnl_nlmsg_batch::overflow