]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/ppp: remove ppph check in favor of flag
authorVictor Julien <vjulien@oisf.net>
Fri, 12 Apr 2024 13:19:45 +0000 (15:19 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 23 May 2024 15:27:38 +0000 (17:27 +0200)
As we now support variable size headers, we can't use the old pointer.

Replace with a flag.

(cherry picked from commit 6067955afd225e43fa0b54c66c5b0f7f260109ed)

src/decode-ipv4.c
src/decode-ppp.c
src/decode.h

index 92d0c6ecfd5c85a49a9fec68309b5639642af5d3..c1bb9cce4731887956f3b932c08b37619bc8a646 100644 (file)
@@ -601,7 +601,7 @@ int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
             }
         case IPPROTO_IP:
             /* check PPP VJ uncompressed packets and decode tcp dummy */
-            if(p->ppph != NULL && SCNtohs(p->ppph->protocol) == PPP_VJ_UCOMP)    {
+            if (p->flags & PKT_PPP_VJ_UCOMP) {
                 DecodeTCP(tv, dtv, p, pkt + IPV4_GET_HLEN(p),
                           IPV4_GET_IPLEN(p) -  IPV4_GET_HLEN(p));
             }
index 6507bc0a6ee9618c8ba97f278abfc0cc1b106d98..a05c4c3edd2f7995067ea9ef2cf8792536e96bf8 100644 (file)
@@ -75,6 +75,7 @@ static int DecodePPPCompressedProto(ThreadVars *tv, DecodeThreadVars *dtv, Packe
             }
 
             if (likely(IPV4_GET_RAW_VER((IPV4Hdr *)(pkt + data_offset)) == 4)) {
+                p->flags |= PKT_PPP_VJ_UCOMP;
                 return DecodeIPV4(tv, dtv, p, pkt + data_offset, (uint16_t)(len - data_offset));
             } else
                 return TM_ECODE_FAILED;
index 4516d3709ee94d922b076226a09268e9682f4e8e..ef555b5fa3d26645e31fb3dea41787e0316698e6 100644 (file)
@@ -984,7 +984,8 @@ void DecodeUnregisterCounters(void);
 
 /** Flag to indicate that packet header or contents should not be inspected */
 #define PKT_NOPACKET_INSPECTION BIT_U32(0)
-// vacancy
+/** Packet has a PPP_VJ_UCOMP header */
+#define PKT_PPP_VJ_UCOMP BIT_U32(1)
 
 /** Flag to indicate that packet contents should not be inspected */
 #define PKT_NOPAYLOAD_INSPECTION BIT_U32(2)