From: Phil Young Date: Mon, 1 Jun 2020 15:02:49 +0000 (-0400) Subject: Napatech: Fix network byte order when comparing addresses X-Git-Tag: suricata-6.0.0-beta1~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ccd44b144c68d104be42d390a233d5cd0c5ef74;p=thirdparty%2Fsuricata.git Napatech: Fix network byte order when comparing addresses This fixes an issue where the "endieness" was not properly accounted for when comparing two IPv4 addresses to be sorted. --- diff --git a/src/source-napatech.c b/src/source-napatech.c index e3416cbb74..3eab47a74f 100644 --- a/src/source-napatech.c +++ b/src/source-napatech.c @@ -457,7 +457,7 @@ static int ProgramFlow(Packet *p, int is_inline) v4Tuple.sa = pIPv4_hdr->src_addr; v4Tuple.da = pIPv4_hdr->dst_addr; } else { - do_swap = (pIPv4_hdr->src_addr > pIPv4_hdr->dst_addr); + do_swap = (htonl(pIPv4_hdr->src_addr) > htonl(pIPv4_hdr->dst_addr)); if (!do_swap) { /* already in order */ v4Tuple.sa = pIPv4_hdr->src_addr;