summaryrefslogtreecommitdiffstats
path: root/src/extra/ipv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/extra/ipv4.c')
-rw-r--r--src/extra/ipv4.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/extra/ipv4.c b/src/extra/ipv4.c
index 3eb1054..0227b62 100644
--- a/src/extra/ipv4.c
+++ b/src/extra/ipv4.c
@@ -27,7 +27,7 @@
/**
* nfq_ip_get_hdr - get IPv4 header
- * \param pktb: pointer to network packet buffer
+ * \param pktb: Pointer to user-space network packet buffer
*
* This funcion returns NULL if the IPv4 is malformed or the protocol version
* is not 4. On success, it returns a valid pointer to the IPv4 header.
@@ -57,8 +57,8 @@ struct iphdr *nfq_ip_get_hdr(struct pkt_buff *pktb)
/**
* nfq_ip_set_transport_header - set transport header
- * \param pktb: pointer to network packet buffer
- * \param iph: pointer to the IPv4 header
+ * \param pktb: Pointer to user-space network packet buffer
+ * \param iph: Pointer to the IPv4 header
*
* Sets the \b transport_header field in \b pktb
*
@@ -79,7 +79,7 @@ int nfq_ip_set_transport_header(struct pkt_buff *pktb, struct iphdr *iph)
/**
* nfq_ip_set_checksum - set IPv4 checksum
- * \param iph: pointer to the IPv4 header
+ * \param iph: Pointer to the IPv4 header
*
* \note Call to this function if you modified the IPv4 header to update the
* checksum.
@@ -95,29 +95,29 @@ void nfq_ip_set_checksum(struct iphdr *iph)
/**
* nfq_ip_mangle - mangle IPv4 packet buffer
- * \param pktb: pointer to network packet buffer
- * \param dataoff: offset to layer 4 header
- * \param match_offset: offset to content that you want to mangle
- * \param match_len: length of the existing content you want to mangle
- * \param rep_buffer: pointer to data you want to use to replace current content
- * \param rep_len: length of data you want to use to replace current content
+ * \param pktb: Pointer to user-space network packet buffer
+ * \param dataoff: Offset to layer 4 header
+ * \param match_offset: Offset to content that you want to mangle
+ * \param match_len: Length of the existing content you want to mangle
+ * \param rep_buffer: Pointer to data you want to use to replace current content
+ * \param 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 and recalculates the IPv4
* checksum (if necessary)
*/
EXPORT_SYMBOL
-int nfq_ip_mangle(struct pkt_buff *pkt, unsigned int dataoff,
+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)
{
- struct iphdr *iph = (struct iphdr *) pkt->network_header;
+ struct iphdr *iph = (struct iphdr *) pktb->network_header;
- if (!pktb_mangle(pkt, dataoff, match_offset, match_len,
- rep_buffer, rep_len))
+ if (!pktb_mangle(pktb, dataoff, match_offset, match_len, rep_buffer,
+ rep_len))
return 0;
/* fix IP hdr checksum information */
- iph->tot_len = htons(pkt->len);
+ iph->tot_len = htons(pktb->len);
nfq_ip_set_checksum(iph);
return 1;
@@ -125,13 +125,13 @@ int nfq_ip_mangle(struct pkt_buff *pkt, unsigned int dataoff,
/**
* nfq_pkt_snprintf_ip - print IPv4 header into buffer in iptables LOG format
- * \param buf: pointer to buffer that will be used to print the header
- * \param size: size of the buffer (or remaining room in it)
- * \param ip: pointer to a valid IPv4 header
+ * \param buf: Pointer to buffer that will be used to print the header
+ * \param size: Size of the buffer (or remaining room in it)
+ * \param iph: Pointer to a valid IPv4 header
*
- * This function returns the number of bytes that would have been written in
- * case that there is enough room in the buffer. Read snprintf manpage for more
- * information to know more about this strange behaviour.
+ * This function returns the number of bytes written (excluding the
+ * string-terminating NUL) *assuming sufficient room in the buffer*.
+ * Read the snprintf manpage for more information about this strange behaviour.
*/
EXPORT_SYMBOL
int nfq_ip_snprintf(char *buf, size_t size, const struct iphdr *iph)