summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2011-08-10 14:17:02 -0700
committerSam Roberts <vieuxtech@gmail.com>2011-08-10 14:17:02 -0700
commit037dc4173ba6b84c212694f07857d6a536e6a4c6 (patch)
treef8f97cb7868ba968091a48db4d8fc333047cb44f
parent43899aa0ed4b9c1ed1434533b54e3976d2bea45c (diff)
downloadlibnet-037dc4173ba6b84c212694f07857d6a536e6a4c6.tar.gz
Fix libnet_build_igmp() to not reverse the order of the ip address.
libnet APIs that take IP addresses as a uint32_t expect them to already be in network byte order.
-rw-r--r--libnet/include/libnet/libnet-functions.h2
-rw-r--r--libnet/src/libnet_build_igmp.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libnet/include/libnet/libnet-functions.h b/libnet/include/libnet/libnet-functions.h
index 5bcfdbf..7cc3060 100644
--- a/libnet/include/libnet/libnet-functions.h
+++ b/libnet/include/libnet/libnet-functions.h
@@ -799,7 +799,7 @@ uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param type packet type
* @param code packet code (should be 0)
* @param sum checksum (0 for libnet to autofill)
- * @param ip IPv4 address
+ * @param ip IPv4 address (in standard/network byte order)
* @param payload optional payload or NULL
* @param payload_s payload length or 0
* @param l pointer to a libnet context
diff --git a/libnet/src/libnet_build_igmp.c b/libnet/src/libnet_build_igmp.c
index bb0e14a..9dd5bc6 100644
--- a/libnet/src/libnet_build_igmp.c
+++ b/libnet/src/libnet_build_igmp.c
@@ -69,7 +69,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
igmp_hdr.igmp_type = type; /* packet type */
igmp_hdr.igmp_code = code; /* packet code */
igmp_hdr.igmp_sum = (sum ? htons(sum) : 0); /* packet checksum */
- igmp_hdr.igmp_group.s_addr = htonl(ip);
+ igmp_hdr.igmp_group.s_addr = ip;
n = libnet_pblock_append(l, p, (uint8_t *)&igmp_hdr, LIBNET_IGMP_H);
if (n == -1)