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

Functions

struct udphdr * nfq_udp_get_hdr (struct pkt_buff *pktb)
 nfq_udp_get_hdr - get the UDP header. More...
 
 EXPORT_SYMBOL (nfq_udp_get_hdr)
 
void * nfq_udp_get_payload (struct udphdr *udph, struct pkt_buff *pktb)
 nfq_udp_get_payload - get the UDP packet payload. More...
 
 EXPORT_SYMBOL (nfq_udp_get_payload)
 
unsigned int nfq_udp_get_payload_len (struct udphdr *udph, struct pkt_buff *pktb)
 nfq_udp_get_payload_len - get the udp packet payload. More...
 
 EXPORT_SYMBOL (nfq_udp_get_payload_len)
 
void nfq_udp_compute_checksum_ipv4 (struct udphdr *udph, struct iphdr *iph)
 nfq_udp_set_checksum_ipv4 - computes a IPv4/TCP packet's segment More...
 
 EXPORT_SYMBOL (nfq_udp_compute_checksum_ipv4)
 
void nfq_udp_compute_checksum_ipv6 (struct udphdr *udph, struct ip6_hdr *ip6h)
 nfq_udp_set_checksum_ipv6 - computes a IPv6/TCP packet's segment More...
 
 EXPORT_SYMBOL (nfq_udp_compute_checksum_ipv6)
 
int nfq_udp_mangle_ipv4 (struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)
 nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer More...
 
 EXPORT_SYMBOL (nfq_udp_mangle_ipv4)
 
int nfq_udp_snprintf (char *buf, size_t size, const struct udphdr *udph)
 nfq_pkt_snprintf_udp_hdr - print udp header into one buffer in a humnan readable way More...
 
 EXPORT_SYMBOL (nfq_udp_snprintf)
 

Detailed Description

Function Documentation

EXPORT_SYMBOL ( nfq_udp_get_hdr  )
EXPORT_SYMBOL ( nfq_udp_get_payload  )
EXPORT_SYMBOL ( nfq_udp_get_payload_len  )
EXPORT_SYMBOL ( nfq_udp_compute_checksum_ipv4  )
EXPORT_SYMBOL ( nfq_udp_compute_checksum_ipv6  )
EXPORT_SYMBOL ( nfq_udp_mangle_ipv4  )
EXPORT_SYMBOL ( nfq_udp_snprintf  )
void nfq_udp_compute_checksum_ipv4 ( struct udphdr *  udph,
struct iphdr *  iph 
)

nfq_udp_set_checksum_ipv4 - computes a IPv4/TCP packet's segment

Parameters
iphdrppointer to the ip header
ippayloadpayload of the ip packet
Returns
the checksum of the udp segment.
See also
nfq_pkt_compute_ip_checksum
nfq_pkt_compute_udp_checksum

References nfq_checksum_tcpudp_ipv4().

Referenced by nfq_udp_mangle_ipv4().

Here is the call graph for this function:

Here is the caller graph for this function:

void nfq_udp_compute_checksum_ipv6 ( struct udphdr *  udph,
struct ip6_hdr *  ip6h 
)

nfq_udp_set_checksum_ipv6 - computes a IPv6/TCP packet's segment

Parameters
iphdrppointer to the ip header
ippayloadpayload of the ip packet
Returns
the checksum of the udp segment.
See also
nfq_pkt_compute_ip_checksum
nfq_pkt_compute_udp_checksum

References nfq_checksum_tcpudp_ipv6().

Here is the call graph for this function:

struct udphdr* nfq_udp_get_hdr ( struct pkt_buff pktb)

nfq_udp_get_hdr - get the UDP header.

Parameters
headpointer to the beginning of the packet
tailpointer to the tail of the packet

This function returns NULL if invalid UDP header is found. On success, it returns the UDP header.

References NULL, pkt_buff::tail, and pkt_buff::transport_header.

void* nfq_udp_get_payload ( struct udphdr *  udph,
struct pkt_buff pktb 
)

nfq_udp_get_payload - get the UDP packet payload.

Parameters
udphthe pointer to the UDP header.
tailpointer to the tail of the packet

References len, NULL, pkt_buff::tail, and pkt_buff::transport_header.

unsigned int nfq_udp_get_payload_len ( struct udphdr *  udph,
struct pkt_buff pktb 
)

nfq_udp_get_payload_len - get the udp packet payload.

Parameters
udpthe pointer to the udp header.

References pkt_buff::tail, and pkt_buff::transport_header.

int nfq_udp_mangle_ipv4 ( struct pkt_buff pkt,
unsigned int  match_offset,
unsigned int  match_len,
const char *  rep_buffer,
unsigned int  rep_len 
)

nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer

Parameters
pktbpointer to network packet buffer
match_offsetoffset to content that you want to mangle
match_lenlength of the existing content you want to mangle
rep_bufferpointer to data you want to use to replace current content
rep_lenlength of data you want to use to replace current content
Note
This function recalculates the IPv4 and TCP checksums for you.

References pkt_buff::network_header, nfq_ip_mangle(), and nfq_udp_compute_checksum_ipv4().

Here is the call graph for this function:

int nfq_udp_snprintf ( char *  buf,
size_t  size,
const struct udphdr *  udph 
)

nfq_pkt_snprintf_udp_hdr - print udp header into one buffer in a humnan readable way

Parameters
bufpointer to buffer that is used to print the object
sizesize of the buffer (or remaining room in it).
udppointer to a valid udp header.