From 7e3f071e4967303c3424d0c0ea812afb2889bbec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 12 Apr 2024 15:26:46 +0200 Subject: [PATCH] decode/ppp: clean up ppph pointer use No users of the pointer anymore, so remove it. --- src/decode-ppp.c | 25 ++++--------------------- src/decode.h | 1 - src/packet.c | 1 - 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/decode-ppp.c b/src/decode-ppp.c index a05c4c3edd..2e558ab5bf 100644 --- a/src/decode-ppp.c +++ b/src/decode-ppp.c @@ -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; diff --git a/src/decode.h b/src/decode.h index a591c7e3f5..c0b1b67709 100644 --- a/src/decode.h +++ b/src/decode.h @@ -576,7 +576,6 @@ typedef struct Packet_ ICMPV6Hdr *icmpv6h; - PPPHdr *ppph; PPPOESessionHdr *pppoesh; PPPOEDiscoveryHdr *pppoedh; diff --git a/src/packet.c b/src/packet.c index 30ef4f11b3..a4ba2ba87f 100644 --- a/src/packet.c +++ b/src/packet.c @@ -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;