]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/ppp: clean up ppph pointer use
authorVictor Julien <vjulien@oisf.net>
Fri, 12 Apr 2024 13:26:46 +0000 (15:26 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 23 May 2024 15:27:38 +0000 (17:27 +0200)
No users of the pointer anymore, so remove it.

(cherry picked from commit 7e3f071e4967303c3424d0c0ea812afb2889bbec)

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

index a05c4c3edd2f7995067ea9ef2cf8792536e96bf8..2e558ab5bf51aabcd1489846282120774cb409a7 100644 (file)
@@ -215,17 +215,10 @@ int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
     }
     /* implied proto_offset + proto_size == 4, so continue below */
 
-    p->ppph = (PPPHdr *)pkt;
-
-    SCLogDebug("p %p pkt %p PPP protocol %04x Len: %" PRIu32 "", p, pkt, SCNtohs(p->ppph->protocol),
-            len);
-
-    int r = DecodePPPUncompressedProto(
-            tv, dtv, p, pkt, len, SCNtohs(p->ppph->protocol), data_offset);
-    if (r < 0) {
-        p->ppph = NULL;
-    }
-    return r;
+    const PPPHdr *ppph = (PPPHdr *)pkt;
+    SCLogDebug(
+            "p %p pkt %p PPP protocol %04x Len: %" PRIu32 "", p, pkt, SCNtohs(ppph->protocol), len);
+    return DecodePPPUncompressedProto(tv, dtv, p, pkt, len, SCNtohs(ppph->protocol), data_offset);
 }
 
 /* TESTS BELOW */
@@ -321,11 +314,6 @@ static int DecodePPPtest03 (void)
 
     FlowShutdown();
 
-    if(p->ppph == NULL) {
-        SCFree(p);
-        return 0;
-    }
-
     if(ENGINE_ISSET_EVENT(p,PPP_PKT_TOO_SMALL))  {
         SCFree(p);
         return 0;
@@ -379,11 +367,6 @@ static int DecodePPPtest04 (void)
 
     FlowShutdown();
 
-    if(p->ppph == NULL) {
-        SCFree(p);
-        return 0;
-    }
-
     if (!(ENGINE_ISSET_EVENT(p,IPV4_TRUNC_PKT))) {
         SCFree(p);
         return 0;
index ef555b5fa3d26645e31fb3dea41787e0316698e6..da41726e806b1022225e63b1f3c65dc7f3ba91ea 100644 (file)
@@ -566,7 +566,6 @@ typedef struct Packet_
 
     ICMPV6Hdr *icmpv6h;
 
-    PPPHdr *ppph;
     PPPOESessionHdr *pppoesh;
     PPPOEDiscoveryHdr *pppoedh;
 
index 40f3bdfcf385a2277bdc7ea387d4a6739dd04f35..0a1abda2c5486eab88bad2e34aa0d0f340af3b6f 100644 (file)
@@ -137,7 +137,6 @@ void PacketReinit(Packet *p)
     if (p->icmpv6h != NULL) {
         CLEAR_ICMPV6_PACKET(p);
     }
-    p->ppph = NULL;
     p->pppoesh = NULL;
     p->pppoedh = NULL;
     p->greh = NULL;