]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/icmpv4: rename ICMPV4_GET_EMB_IPV4 to PacketGetICMPv4EmbIPv4
authorVictor Julien <vjulien@oisf.net>
Thu, 11 Apr 2024 15:37:15 +0000 (17:37 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 26 Apr 2024 18:59:45 +0000 (20:59 +0200)
Follows function nameing style.

Ticket: #5517.

src/decode-icmpv4.c
src/decode-icmpv4.h
src/decode.h
src/flow-hash.c

index cd5708a62626a56716970a6e744a0dd81bb12599..33ed09ada447ab982c552c3b56b01165efdc6623 100644 (file)
@@ -506,8 +506,8 @@ static int DecodeICMPV4test03(void)
     FAIL_IF(p->l4.vars.icmpv4.emb_dport != 33450);
 
     /* check the src,dst IPs contained inside */
-    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p));
-    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p));
+    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p));
+    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p));
     char s[16], d[16];
     PrintInet(AF_INET, &src_ip, s, sizeof(s));
     PrintInet(AF_INET, &dst_ip, d, sizeof(d));
@@ -574,8 +574,8 @@ static int DecodeICMPV4test04(void)
     }
 
     // check the src,dst IPs contained inside
-    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p));
-    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p));
+    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p));
+    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p));
     char s[16], d[16];
     PrintInet(AF_INET, &src_ip, s, sizeof(s));
     PrintInet(AF_INET, &dst_ip, d, sizeof(d));
@@ -642,8 +642,8 @@ static int DecodeICMPV4test05(void)
     }
 
     // check the src,dst IPs contained inside
-    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p));
-    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p));
+    uint32_t src_ip = IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p));
+    uint32_t dst_ip = IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p));
     char s[16], d[16];
     PrintInet(AF_INET, &src_ip, s, sizeof(s));
     PrintInet(AF_INET, &dst_ip, d, sizeof(d));
index 920d896f928cb8db87077263729afdb56a1a2826..730f78ffd487f346c75db8f13a23eb4c36ce0d15 100644 (file)
@@ -252,7 +252,7 @@ typedef struct ICMPV4Timestamp_ {
  */
 #define ICMPV4_DEST_UNREACH_IS_VALID(p)                                                            \
     ((!((p)->flags & PKT_IS_INVALID)) && PacketIsICMPv4((p)) &&                                    \
-            ((p)->icmp_s.type == ICMP_DEST_UNREACH) && (ICMPV4_GET_EMB_IPV4((p)) != NULL) &&       \
+            ((p)->icmp_s.type == ICMP_DEST_UNREACH) && (PacketGetICMPv4EmbIPv4((p)) != NULL) &&    \
             (p)->l4.vars.icmpv4.emb_ports_set)
 
 /**
index e8c86a13b051fdcb03301d1d92983f523e81814b..9175f6cc3ce6dbe14aacff67702efe54fec4cb54 100644 (file)
@@ -845,7 +845,7 @@ static inline bool PacketIsICMPv4(const Packet *p)
     return p->l4.type == PACKET_L4_ICMPV4;
 }
 
-static inline const IPV4Hdr *ICMPV4_GET_EMB_IPV4(const Packet *p)
+static inline const IPV4Hdr *PacketGetICMPv4EmbIPv4(const Packet *p)
 {
     const uint8_t *start = (const uint8_t *)PacketGetICMPv4(p);
     const uint8_t *ip = start + p->l4.vars.icmpv4.emb_ip4h_offset;
index 88d44d6fc23c05657e8dff45d51923f4b8eb8e5e..c5063f7d3795f22b757463e2e98ecb5832dfda6f 100644 (file)
@@ -218,8 +218,8 @@ static inline uint32_t FlowGetHash(const Packet *p)
             hash = hashword(fhk.u32, ARRAY_SIZE(fhk.u32), flow_config.hash_rand);
 
         } else if (ICMPV4_DEST_UNREACH_IS_VALID(p)) {
-            uint32_t psrc = IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p));
-            uint32_t pdst = IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p));
+            uint32_t psrc = IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p));
+            uint32_t pdst = IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p));
             FlowHashKey4 fhk = { .pad[0] = 0 };
 
             const int ai = (psrc > pdst);
@@ -468,8 +468,8 @@ static inline int FlowCompareICMPv4(Flow *f, const Packet *p)
         /* first check the direction of the flow, in other words, the client ->
          * server direction as it's most likely the ICMP error will be a
          * response to the clients traffic */
-        if ((f->src.addr_data32[0] == IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p))) &&
-                (f->dst.addr_data32[0] == IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p))) &&
+        if ((f->src.addr_data32[0] == IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p))) &&
+                (f->dst.addr_data32[0] == IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p))) &&
                 f->sp == p->l4.vars.icmpv4.emb_sport && f->dp == p->l4.vars.icmpv4.emb_dport &&
                 f->proto == ICMPV4_GET_EMB_PROTO(p) && f->recursion_level == p->recursion_level &&
                 CmpVlanIds(f->vlan_id, p->vlan_id) &&
@@ -478,8 +478,8 @@ static inline int FlowCompareICMPv4(Flow *f, const Packet *p)
 
         /* check the less likely case where the ICMP error was a response to
          * a packet from the server. */
-        } else if ((f->dst.addr_data32[0] == IPV4_GET_RAW_IPSRC_U32(ICMPV4_GET_EMB_IPV4(p))) &&
-                   (f->src.addr_data32[0] == IPV4_GET_RAW_IPDST_U32(ICMPV4_GET_EMB_IPV4(p))) &&
+        } else if ((f->dst.addr_data32[0] == IPV4_GET_RAW_IPSRC_U32(PacketGetICMPv4EmbIPv4(p))) &&
+                   (f->src.addr_data32[0] == IPV4_GET_RAW_IPDST_U32(PacketGetICMPv4EmbIPv4(p))) &&
                    f->dp == p->l4.vars.icmpv4.emb_sport && f->sp == p->l4.vars.icmpv4.emb_dport &&
                    f->proto == ICMPV4_GET_EMB_PROTO(p) &&
                    f->recursion_level == p->recursion_level && CmpVlanIds(f->vlan_id, p->vlan_id) &&