summaryrefslogtreecommitdiff
path: root/libnet/include
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2009-03-30 17:59:59 -0700
committerSam Roberts <vieuxtech@gmail.com>2009-03-30 17:59:59 -0700
commitcdbfc1e4e4bc559ea7f19e2926209a73b3e9caa4 (patch)
tree148e9c77d4d58099defaf0d830b2e26c5b05f700 /libnet/include
parenta3694435cacc323efe6287747ae8778c17e897b1 (diff)
parent633599a72995f8f91ff55758b515e61049fb688a (diff)
downloadlibnet-cdbfc1e4e4bc559ea7f19e2926209a73b3e9caa4.tar.gz
Merge branch 'ip_offset-patch' into v1.1.2.1-forkv1.1.2.1-fork
Diffstat (limited to 'libnet/include')
-rw-r--r--libnet/include/libnet/libnet-functions.h5
-rw-r--r--libnet/include/libnet/libnet-structures.h15
2 files changed, 16 insertions, 4 deletions
diff --git a/libnet/include/libnet/libnet-functions.h b/libnet/include/libnet/libnet-functions.h
index c4fe599..99b1139 100644
--- a/libnet/include/libnet/libnet-functions.h
+++ b/libnet/include/libnet/libnet-functions.h
@@ -794,6 +794,7 @@ u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
* Builds a version 4 RFC 791 Internet Protocol (IP) header.
* @param len total length of the IP packet including all subsequent data
+ * FIXME There is no reason this can't be calculated if zero is passed.
* @param tos type of service bits
* @param id IP identification number
* @param frag fragmentation bits and offset
@@ -2080,10 +2081,10 @@ u_int8_t type);
* Function updates referer used to compute the checksum. All
* pblock need to know where is their referer (ie IP header).
* So, this function is called each time a new IP header is inserted.
- * It updates the ip_pos field (referer) of each subsequent pblock.
+ * It updates the ip_offset field (referer) of each previous pblock.
*/
void
-libnet_pblock_record_ip_offset(libnet_t *l, u_int32_t offset);
+libnet_pblock_record_ip_offset(libnet_t *l, libnet_pblock_t *p);
/*
* [Internal]
diff --git a/libnet/include/libnet/libnet-structures.h b/libnet/include/libnet/libnet-structures.h
index 38aff5d..eb7de76 100644
--- a/libnet/include/libnet/libnet-structures.h
+++ b/libnet/include/libnet/libnet-structures.h
@@ -79,8 +79,19 @@ struct libnet_protocol_block
u_int8_t *buf; /* protocol buffer */
u_int32_t b_len; /* length of buf */
u_int16_t h_len; /* header length (for checksumming) */
- u_int32_t ip_offset; /* offset to IP header for csums */
- u_int32_t copied; /* bytes copied */
+ /* Unused for IPV4_H block types.
+ * For protocols that sit on top of IP, it should be the the amount of
+ * buf that is the header, and will be included in the checksum.
+ */
+ u_int32_t ip_offset; /* offset from end of pkt to beginning of IP header for csums */
+ /* Unused for IPV4_H block types.
+ * For protocols that sit on top of IP (UDP, ICMP, ...), they often
+ * include some information from the IP header (in the form of a "pseudo
+ * header") in their own checksum calculation. To build that
+ * pseudo-header, thet need to find the real header.
+ */
+ u_int32_t copied; /* bytes copied - the amount of data copied into buf */
+ /* Used and updated by libnet_pblock_append(). */
u_int8_t type; /* type of pblock */
/* this needs to be updated every time a new packet builder is added */
#define LIBNET_PBLOCK_ARP_H 0x01 /* ARP header */