.TH "ipv4" 3 "Thu Jan 28 2021" "Version 1.0.5" "libnetfilter_queue" \" -*- nroff -*- .ad l .nh .SH NAME ipv4 \- IPv4 helper functions .SH SYNOPSIS .br .PP .SS "Modules" .in +1c .ti -1c .RI "\fBInternal IP functions\fP" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "struct iphdr * \fBnfq_ip_get_hdr\fP (struct pkt_buff *pktb)" .br .ti -1c .RI "int \fBnfq_ip_set_transport_header\fP (struct pkt_buff *pktb, struct iphdr *iph)" .br .ti -1c .RI "int \fBnfq_ip_mangle\fP (struct pkt_buff *pktb, unsigned int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)" .br .ti -1c .RI "int \fBnfq_ip_snprintf\fP (char *buf, size_t size, const struct iphdr *iph)" .br .in -1c .SH "Detailed Description" .PP .SH "Function Documentation" .PP .SS "struct iphdr* nfq_ip_get_hdr (struct pkt_buff * pktb)" nfq_ip_get_hdr - get the IPv4 header .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to user-space network packet buffer .RE .PP \fBReturns\fP .RS 4 validated pointer to the IPv4 header or NULL if IP is malformed or not version 4 .RE .PP 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\&. .PP Definition at line 40 of file ipv4\&.c\&. .SS "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)" nfq_ip_mangle - mangle IPv4 packet buffer .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to user-space network packet buffer .br \fIdataoff\fP Offset to layer 4 header, or zero to mangle IP header .br \fImatch_offset\fP Offset to content that you want to mangle .br \fImatch_len\fP Length of the existing content you want to mangle .br \fIrep_buffer\fP Pointer to data you want to use to replace current content .br \fIrep_len\fP Length of data you want to use to replace current content .RE .PP \fBReturns\fP .RS 4 1 for success and 0 for failure\&. See \fBpktb_mangle()\fP for failure case .RE .PP \fBNote\fP .RS 4 This function updates the IPv4 length if necessary and recalculates the IPv4 checksum\&. .RE .PP .PP Definition at line 127 of file ipv4\&.c\&. .SS "int nfq_ip_set_transport_header (struct pkt_buff * pktb, struct iphdr * iph)" nfq_ip_set_transport_header - set the \fBtransport_header\fP field in \fBpktb\fP .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to user-space network packet buffer .br \fIiph\fP Pointer to the IPv4 header .RE .PP \fBReturns\fP .RS 4 0 on success or -1 if a minimal validation check fails .RE .PP \fBNote\fP .RS 4 Most programs should call \fBnfq_ip_set_transport_header\fP as soon as possible, since most layer 4 helper functions assume the \fBtransport_header\fP field is valid\&. .RE .PP .PP Definition at line 73 of file ipv4\&.c\&. .SS "int nfq_ip_snprintf (char * buf, size_t size, const struct iphdr * iph)" nfq_pkt_snprintf_ip - print IPv4 header into buffer in iptables LOG format .PP \fBParameters\fP .RS 4 \fIbuf\fP Pointer to buffer that will be used to print the header .br \fIsize\fP Size of the buffer (or remaining room in it) .br \fIiph\fP Pointer to a valid IPv4 header .RE .PP \fBReturns\fP .RS 4 same as snprintf .RE .PP \fBSee also\fP .RS 4 \fBsnprintf\fP(3) .RE .PP .PP Definition at line 153 of file ipv4\&.c\&. .SH "Author" .PP Generated automatically by Doxygen for libnetfilter_queue from the source code\&.