switch (icmp6_ip6h->s_ip6_nxt) {
case IPPROTO_TCP:
if (len >= IPV6_HEADER_LEN + TCP_HEADER_LEN ) {
- p->icmpv6vars.emb_tcph = (TCPHdr*)(partial_packet + IPV6_HEADER_LEN);
- p->icmpv6vars.emb_sport = p->icmpv6vars.emb_tcph->th_sport;
- p->icmpv6vars.emb_dport = p->icmpv6vars.emb_tcph->th_dport;
+ TCPHdr *emb_tcph = (TCPHdr *)(partial_packet + IPV6_HEADER_LEN);
+ p->icmpv6vars.emb_sport = emb_tcph->th_sport;
+ p->icmpv6vars.emb_dport = emb_tcph->th_dport;
+ p->icmpv6vars.emb_ports_set = true;
SCLogDebug("ICMPV6->IPV6->TCP header sport: "
"%"PRIu16" dport %"PRIu16"", p->icmpv6vars.emb_sport,
break;
case IPPROTO_UDP:
if (len >= IPV6_HEADER_LEN + UDP_HEADER_LEN ) {
- p->icmpv6vars.emb_udph = (UDPHdr*)(partial_packet + IPV6_HEADER_LEN);
- p->icmpv6vars.emb_sport = p->icmpv6vars.emb_udph->uh_sport;
- p->icmpv6vars.emb_dport = p->icmpv6vars.emb_udph->uh_dport;
+ UDPHdr *emb_udph = (UDPHdr *)(partial_packet + IPV6_HEADER_LEN);
+ p->icmpv6vars.emb_sport = emb_udph->uh_sport;
+ p->icmpv6vars.emb_dport = emb_udph->uh_dport;
+ p->icmpv6vars.emb_ports_set = true;
SCLogDebug("ICMPV6->IPV6->UDP header sport: "
"%"PRIu16" dport %"PRIu16"", p->icmpv6vars.emb_sport,
break;
case IPPROTO_ICMPV6:
- p->icmpv6vars.emb_icmpv6h = (ICMPV6Hdr*)(partial_packet + IPV6_HEADER_LEN);
p->icmpv6vars.emb_sport = 0;
p->icmpv6vars.emb_dport = 0;
/** macro for icmpv6 embedded "protocol" access */
#define ICMPV6_GET_EMB_PROTO(p) (p)->icmpv6vars.emb_ip6_proto_next
/** macro for icmpv6 embedded "ipv6h" header access */
-#define ICMPV6_GET_EMB_IPV6(p) (p)->icmpv6vars.emb_ipv6h
-/** macro for icmpv6 embedded "tcph" header access */
-#define ICMPV6_GET_EMB_TCP(p) (p)->icmpv6vars.emb_tcph
-/** macro for icmpv6 embedded "udph" header access */
-#define ICMPV6_GET_EMB_UDP(p) (p)->icmpv6vars.emb_udph
-/** macro for icmpv6 embedded "icmpv6h" header access */
-#define ICMPV6_GET_EMB_icmpv6h(p) (p)->icmpv6vars.emb_icmpv6h
+#define ICMPV6_GET_EMB_IPV6(p) (p)->icmpv6vars.emb_ipv6h
typedef struct ICMPV6Info_
{
/** Pointers to the embedded packet headers */
IPV6Hdr *emb_ipv6h;
- TCPHdr *emb_tcph;
- UDPHdr *emb_udph;
- ICMPV6Hdr *emb_icmpv6h;
/** IPv6 src and dst address */
uint32_t emb_ip6_src[4];
uint32_t emb_ip6_dst[4];
uint8_t emb_ip6_proto_next;
+ bool emb_ports_set;
/** TCP/UDP ports */
uint16_t emb_sport;
uint16_t emb_dport;