From 037dc4173ba6b84c212694f07857d6a536e6a4c6 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 10 Aug 2011 14:17:02 -0700 Subject: 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. --- libnet/include/libnet/libnet-functions.h | 2 +- libnet/src/libnet_build_igmp.c | 2 +- 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) -- cgit v1.2.1