Man page - pktb_mangle(3)
Packages contains this manual
- nfq_set_queue_maxlen(3)
- nfq_fd(3)
- nfq_set_mode(3)
- nfq_get_physoutdev(3)
- nfq_nlmsg_cfg_put_params(3)
- nfq_nlmsg_cfg_put_qmaxlen(3)
- nfq_get_nfmark(3)
- nfq_get_payload(3)
- nfq_get_physindev_name(3)
- nfq_get_secctx(3)
- nfq_unbind_pf(3)
- nfq_get_physoutdev_name(3)
- nfq_set_verdict_batch(3)
- nfq_nlmsg_verdict_put_pkt(3)
- nfq_set_verdict_batch2(3)
- nfq_get_outdev_name(3)
- nfq_get_outdev(3)
- nfq_set_verdict2(3)
- nfq_get_msg_packet_hdr(3)
- nfq_get_timestamp(3)
- nfq_udp_get_payload(3)
- pktb_alloc(3)
- nfq_create_queue(3)
- nfq_snprintf_xml(3)
- nfq_get_physindev(3)
- nfq_destroy_queue(3)
- nfq_set_verdict(3)
- nfq_ip6_get_hdr(3)
- nfq_tcp_get_hdr(3)
- pktb_network_header(3)
- nfq_ip6_snprintf(3)
- nfq_bind_pf(3)
- nfq_set_verdict_mark(3)
- nfq_nlmsg_verdict_put_mark(3)
- nfq_get_indev_name(3)
- nfq_get_gid(3)
- pktb_mangle(3)
- pktb_mangled(3)
- pktb_trim(3)
- nfq_udp_mangle_ipv4(3)
- nfq_nlmsg_parse(3)
- nfq_ip_get_hdr(3)
- nfq_set_queue_flags(3)
- nfq_udp_get_hdr(3)
- nfq_udp_mangle_ipv6(3)
- nfq_tcp_mangle_ipv4(3)
- nfq_ip_snprintf(3)
- nfq_get_indev(3)
- pktb_push(3)
- nfq_nlmsg_cfg_put_cmd(3)
- pktb_transport_header(3)
- pktb_pull(3)
- nfq_udp_compute_checksum_ipv4(3)
- nfq_tcp_compute_checksum_ipv4(3)
- nfq_handle_packet(3)
- pktb_free(3)
- pktb_put(3)
- pktb_data(3)
- nfq_udp_compute_checksum_ipv6(3)
- nfq_close(3)
- nfq_udp_snprintf(3)
- nfq_ip_mangle(3)
- nfq_nlmsg_verdict_put(3)
- nfq_tcp_snprintf(3)
- pktb_mac_header(3)
- nfq_get_packet_hw(3)
- nfq_get_skbinfo(3)
- nfq_nlmsg_put(3)
- nfq_tcp_mangle_ipv6(3)
- nfq_ip_set_transport_header(3)
- nfq_get_uid(3)
- nfq_tcp_get_payload(3)
- nfq_ip6_set_transport_header(3)
- nfq_ip_set_checksum(3)
- nfq_tcp_compute_checksum_ipv6(3)
- nfq_tcp_get_payload_len(3)
- pktb_len(3)
- nfq_open(3)
- nfq_ip6_mangle(3)
- nfq_udp_get_payload_len(3)
- pktb_tailroom(3)
apt-get install libnetfilter-queue-doc
Manual
pktbuff
NAMESYNOPSIS
Modules
Functions
Detailed Description
Function Documentation
struct pkt_buff * pktb_alloc (int family, void * data, size_t len, size_textra)
uint8_t * pktb_data (struct pkt_buff * pktb)
void pktb_free (struct pkt_buff * pktb)
uint32_t pktb_len (struct pkt_buff * pktb)
int pktb_mangle (struct pkt_buff * pktb, int dataoff, unsigned intmatch_offset, unsigned int match_len, const char * rep_buffer, unsignedint rep_len)
bool pktb_mangled (const struct pkt_buff * pktb)
Author
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_textra)
pktb_alloc - allocate a new packet buffer
Parameters
family
Indicate what
family. Currently supported families are AF_BRIDGE, AF_INET
& AF_INET6.
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
Pointer to a new userspace packet buffer or NULL on failure.
Errors
ENOMEM
From
calloc
()
EPROTONOSUPPORT
family
was
AF_BRIDGE
and
this is not an IP packet (v4 or v6)
See also
calloc (3)
Definition at line 52 of file pktbuff.c .
uint8_t * pktb_data (struct pkt_buff * pktb)
pktb_data - get pointer to network packet
Parameters
pktb Pointer to userspace packet buffer
Returns
Pointer to start of network packet data within pktb
It is appropriate to use pktb_data as the second argument of nfq_nlmsg_verdict_put_pkt()
Definition at line 105 of file pktbuff.c .
void pktb_free (struct pkt_buff * pktb)
pktb_free - release packet buffer
Parameters
pktb Pointer to userspace packet buffer
Definition at line 129 of file pktbuff.c .
uint32_t pktb_len (struct pkt_buff * pktb)
pktb_len - get length of packet buffer
Parameters
pktb Pointer to userspace packet buffer
Returns
Length of packet contained within pktb
It is appropriate to use pktb_len as the third argument of nfq_nlmsg_verdict_put_pkt()
Definition at line 119 of file pktbuff.c .
int pktb_mangle (struct pkt_buff * pktb, int dataoff, unsigned intmatch_offset, unsigned int match_len, const char * rep_buffer, unsignedint rep_len)
pktb_mangle - adjust contents of a packet
Parameters
pktb
Pointer to
userspace packet buffer
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
1 for success and 0 for failure. Failure will occur if the extra argument to the pktb_alloc() call that created pktb is less than the excess of rep_len over match_len
Warning
pktb_mangle does not update any
checksums. Developers should use the appropriate mangler for
the protocol level:
nfq_ip_mangle()
,
nfq_tcp_mangle_ipv4()
or
nfq_udp_mangle_ipv4()
. IPv6 versions are planned.
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
pktb Pointer to userspace packet buffer
Returns
true if packet has been mangled (modified), else false
When assembling a verdict, it is not necessary to return the contents of un-modified packets. Use pktb_mangled to decide whether packet contents need to be returned.
Definition at line 359 of file pktbuff.c .
Author
Generated automatically by Doxygen for libnetfilter_queue from the source code.