decode/icmpv4: rename ICMPV4_GET_EMB_IPV4 to PacketGetICMPv4EmbIPv4

Follows function nameing style.

Ticket: #5517.
pull/10971/head
Victor Julien 2 years ago committed by Victor Julien
parent 6e23419665
commit 0dfa5793db

@ -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));

@ -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)
/**

@ -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;

@ -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) &&

Loading…
Cancel
Save