diff --git a/src/decode-icmpv4.c b/src/decode-icmpv4.c index 50bf49441d..5f1395d29d 100644 --- a/src/decode-icmpv4.c +++ b/src/decode-icmpv4.c @@ -33,6 +33,7 @@ #include "flow.h" #include "util-unittest.h" +#include "util-unittest-helper.h" #include "util-debug.h" /** @@ -318,8 +319,8 @@ static int DecodeICMPV4test01(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; @@ -369,8 +370,8 @@ static int DecodeICMPV4test02(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; @@ -418,8 +419,8 @@ static int DecodeICMPV4test03(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; @@ -490,8 +491,8 @@ static int DecodeICMPV4test04(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; @@ -595,8 +596,8 @@ static int ICMPV4InvalidType07(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; @@ -639,8 +640,8 @@ static int DecodeICMPV4test08(void) { p->src.family = AF_INET; p->dst.family = AF_INET; - p->src.addr_data32[0] = 0x01020304; - p->dst.addr_data32[0] = 0x04030201; + p->src.addr_data32[0] = UTHSetIPv4Address("4.3.2.1");; + p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4");; ip4h.ip_src.s_addr = p->src.addr_data32[0]; ip4h.ip_dst.s_addr = p->dst.addr_data32[0]; diff --git a/src/decode-icmpv6.c b/src/decode-icmpv6.c index fa1020be50..9bad244cd4 100644 --- a/src/decode-icmpv6.c +++ b/src/decode-icmpv6.c @@ -669,7 +669,7 @@ static int ICMPV6EchoReqTest01(void) SCLogDebug("ID: %u seq: %u", ICMPV6_GET_ID(p), ICMPV6_GET_SEQ(p)); if (ICMPV6_GET_TYPE(p) != 128 || ICMPV6_GET_CODE(p) != 0 || - ICMPV6_GET_ID(p) != 61477 || ICMPV6_GET_SEQ(p) != 29987) { + ICMPV6_GET_ID(p) != 9712 || ICMPV6_GET_SEQ(p) != 29987) { SCLogDebug("ICMPv6 Echo request decode failed"); retval = 0; goto end; @@ -723,7 +723,7 @@ static int ICMPV6EchoRepTest01(void) ICMPV6_GET_CODE(p),ICMPV6_GET_ID(p), ICMPV6_GET_SEQ(p)); if (ICMPV6_GET_TYPE(p) != 129 || ICMPV6_GET_CODE(p) != 0 || - ICMPV6_GET_ID(p) != 61477 || ICMPV6_GET_SEQ(p) != 29987) { + ICMPV6_GET_ID(p) != 9712 || ICMPV6_GET_SEQ(p) != 29987) { SCLogDebug("ICMPv6 Echo reply decode failed"); retval = 0; goto end; diff --git a/src/decode-icmpv6.h b/src/decode-icmpv6.h index bcfd6d2828..14433596bd 100644 --- a/src/decode-icmpv6.h +++ b/src/decode-icmpv6.h @@ -79,10 +79,8 @@ /** If message is informational */ /** macro for icmpv6 "id" access */ -/* #define ICMPV6_GET_ID(p) (p)->icmpv6h->icmpv6b.icmpv6i.id */ -#define ICMPV6_GET_ID(p) (p)->icmpv6vars.id +#define ICMPV6_GET_ID(p) (ntohs((p)->icmpv6vars.id)) /** macro for icmpv6 "seq" access */ -/* #define ICMPV6_GET_SEQ(p) (p)->icmpv6h->icmpv6b.icmpv6i.seq */ #define ICMPV6_GET_SEQ(p) (ntohs((p)->icmpv6vars.seq)) /** If message is Error */