logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ipv4 - IPv4 helper functions

Author

       Generated automatically by Doxygen for libnetfilter_queue from the source code.

libnetfilter_queue                                Version 1.0.5                                          ipv4(3)

Detailed Description

Function Documentation

structiphdr*nfq_ip_get_hdr(structpkt_buff*pktb)
       nfq_ip_get_hdr - get the IPv4 header

       Parameterspktb Pointer to user-space network packet buffer

       Returns
           validated pointer to the IPv4 header or NULL if IP is malformed or not version 4

       Many programs will not need to call this function. A possible use is to determine the layer 4 protocol.
       The validation is that the buffer is big enough for the declared lengths in the header, i.e. an extra
       check for packet truncation.

       Definition at line 40 of file ipv4.c.

   intnfq_ip_mangle(structpkt_buff*pktb,unsignedintdataoff,unsignedintmatch_offset,unsignedintmatch_len,constchar*rep_buffer,unsignedintrep_len)
       nfq_ip_mangle - mangle IPv4 packet buffer

       Parameterspktb Pointer to user-space network packet buffer
           dataoff Offset to layer 4 header, or zero to mangle IP header
           match_offset 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. See pktb_mangle() for failure case

       Note
           This function updates the IPv4 length if necessary and recalculates the IPv4 checksum.

       Definition at line 127 of file ipv4.c.

   intnfq_ip_set_transport_header(structpkt_buff*pktb,structiphdr*iph)
       nfq_ip_set_transport_header - set the transport_header field in pktbParameterspktb Pointer to user-space network packet buffer
           iph Pointer to the IPv4 header

       Returns
           0 on success or -1 if a minimal validation check fails

       Note
           Most programs should call nfq_ip_set_transport_header as soon as possible, since most layer 4 helper
           functions assume the transport_header field is valid.

       Definition at line 73 of file ipv4.c.

   intnfq_ip_snprintf(char*buf,size_tsize,conststructiphdr*iph)
       nfq_pkt_snprintf_ip - print IPv4 header into buffer in iptables LOG format

       Parametersbuf Pointer to buffer that will be used to print the header
           size Size of the buffer (or remaining room in it)
           iph Pointer to a valid IPv4 header

       Returns
           same as snprintf

       Seealsosnprintf(3)

       Definition at line 153 of file ipv4.c.

Name

       ipv4 - IPv4 helper functions

Synopsis

ModulesInternalIPfunctionsFunctions
       struct iphdr * nfq_ip_get_hdr (struct pkt_buff *pktb)
       int nfq_ip_set_transport_header (struct pkt_buff *pktb, struct iphdr *iph)
       int nfq_ip_mangle (struct pkt_buff *pktb, unsigned int dataoff, unsigned int match_offset, unsigned int
           match_len, const char *rep_buffer, unsigned int rep_len)
       int nfq_ip_snprintf (char *buf, size_t size, const struct iphdr *iph)

See Also