table of contents
pktbuff(3) | libnetfilter_queue | pktbuff(3) |
NAME¶
pktbuff - User-space network packet buffer
SYNOPSIS¶
Modules¶
Other functions
Functions¶
struct pkt_buff * pktb_alloc (int family, void *data,
size_t len, size_t extra)
uint8_t * pktb_data (struct pkt_buff *pktb)
uint32_t pktb_len (struct pkt_buff *pktb)
void pktb_free (struct pkt_buff *pktb)
int pktb_mangle (struct pkt_buff *pktb, int dataoff, unsigned int
match_offset, unsigned int match_len, const char *rep_buffer, unsigned int
rep_len)
bool pktb_mangled (const struct pkt_buff *pktb)
Detailed Description¶
This library provides the user-space network packet buffer. This abstraction is strongly inspired by Linux kernel network buffer, the so-called sk_buff.
Function Documentation¶
struct pkt_buff * pktb_alloc (int family, void * data, size_t len, size_t extra)¶
pktb_alloc - allocate a new packet buffer
Parameters
data Pointer to packet data
len Packet length
extra Extra memory in the tail to be allocated (for mangling)
This function returns a packet buffer that contains the packet data and some extra memory room in the tail (if requested).
Returns
Errors
EPROTONOSUPPORT family was AF_BRIDGE and this is not an IP packet (v4 or v6)
See also
Definition at line 52 of file pktbuff.c.
uint8_t * pktb_data (struct pkt_buff * pktb)¶
pktb_data - get pointer to network packet
Parameters
Returns
Definition at line 105 of file pktbuff.c.
void pktb_free (struct pkt_buff * pktb)¶
pktb_free - release packet buffer
Parameters
Definition at line 129 of file pktbuff.c.
uint32_t pktb_len (struct pkt_buff * pktb)¶
pktb_len - get length of packet buffer
Parameters
Returns
Definition at line 119 of file pktbuff.c.
int pktb_mangle (struct pkt_buff * pktb, int dataoff, unsigned int match_offset, unsigned int match_len, const char * rep_buffer, unsigned int rep_len)¶
pktb_mangle - adjust contents of a packet
Parameters
dataoff Supplementary offset, usually offset from layer 3 (IP) header to the layer 4 (TCP or UDP) header. Specify zero to access the layer 3 header. If pktb was created in family AF_BRIDGE, specify -ETH_HLEN (a negative offset) to access the layer 2 (MAC) header.
match_offset Further offset to content that you want to mangle
match_len Length of the existing content you want to mangle
rep_buffer Pointer to data you want to use to replace current content
rep_len Length of data you want to use to replace current content
Returns
Warning
It is appropriate to use pktb_mangle to change the MAC header.
Definition at line 314 of file pktbuff.c.
bool pktb_mangled (const struct pkt_buff * pktb)¶
pktb_mangled - test whether packet has been mangled
Parameters
Returns
Definition at line 359 of file pktbuff.c.
Author¶
Generated automatically by Doxygen for libnetfilter_queue from the source code.
Wed Aug 9 2023 | Version 1.0.5 |