]> 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>
Mon, 15 Apr 2024 18:34:38 +0000 (20:34 +0200)
No users of the pointer anymore, so remove it.

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 a591c7e3f534b49c718c62342ebd8b7ae43e7035..c0b1b677098d2e43fac0ac702b562f201e75a96f 100644 (file)
@@ -576,7 +576,6 @@ typedef struct Packet_
 
     ICMPV6Hdr *icmpv6h;
 
-    PPPHdr *ppph;
     PPPOESessionHdr *pppoesh;
     PPPOEDiscoveryHdr *pppoedh;
 
index 30ef4f11b31a61a6508b33333f2755ff71bf4d0e..a4ba2ba87f8f1ecf7ec727e89b623c8eaa40820a 100644 (file)
@@ -138,7 +138,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;