From: Victor Julien Date: Fri, 29 Mar 2024 16:05:17 +0000 (+0100) Subject: decode/pppoe: localize pppoesh header pointer X-Git-Tag: suricata-8.0.0-beta1~1373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4ef910aff86298248b669dc132bf47ada36b91f;p=thirdparty%2Fsuricata.git decode/pppoe: localize pppoesh header pointer Remove header pointer from Packet as there were no users of it. Ticket: #6938. --- diff --git a/src/decode-pppoe.c b/src/decode-pppoe.c index eb5e6acb28..9d54d70e51 100644 --- a/src/decode-pppoe.c +++ b/src/decode-pppoe.c @@ -134,17 +134,19 @@ int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, return TM_ECODE_FAILED; } - p->pppoesh = (PPPOESessionHdr *)pkt; + PPPOESessionHdr *pppoesh = (PPPOESessionHdr *)pkt; - SCLogDebug("PPPOE VERSION %" PRIu32 " TYPE %" PRIu32 " CODE %" PRIu32 " SESSIONID %" PRIu32 " LENGTH %" PRIu32 "", - PPPOE_SESSION_GET_VERSION(p->pppoesh), PPPOE_SESSION_GET_TYPE(p->pppoesh), p->pppoesh->pppoe_code, SCNtohs(p->pppoesh->session_id), SCNtohs(p->pppoesh->pppoe_length)); + SCLogDebug("PPPOE VERSION %" PRIu32 " TYPE %" PRIu32 " CODE %" PRIu32 " SESSIONID %" PRIu32 + " LENGTH %" PRIu32 "", + PPPOE_SESSION_GET_VERSION(pppoesh), PPPOE_SESSION_GET_TYPE(pppoesh), + pppoesh->pppoe_code, SCNtohs(pppoesh->session_id), SCNtohs(pppoesh->pppoe_length)); /* can't use DecodePPP() here because we only get a single 2-byte word to indicate protocol instead of the full PPP header */ - if (SCNtohs(p->pppoesh->pppoe_length) > 0) { + if (SCNtohs(pppoesh->pppoe_length) > 0) { /* decode contained PPP packet */ uint8_t pppoesh_len; - uint16_t ppp_protocol = SCNtohs(p->pppoesh->protocol); + uint16_t ppp_protocol = SCNtohs(pppoesh->protocol); /* According to RFC1661-2, if the least significant bit of the most significant octet is * set, we're dealing with a single-octet protocol field */ diff --git a/src/decode.h b/src/decode.h index 86e7d6faf5..7b1f4bea36 100644 --- a/src/decode.h +++ b/src/decode.h @@ -583,7 +583,6 @@ typedef struct Packet_ TCPHdr *tcph; UDPHdr *udph; - PPPOESessionHdr *pppoesh; PPPOEDiscoveryHdr *pppoedh; /* ptr to the payload of the packet diff --git a/src/packet.c b/src/packet.c index 73c38206db..256cf78109 100644 --- a/src/packet.c +++ b/src/packet.c @@ -121,7 +121,6 @@ void PacketReinit(Packet *p) if (p->udph != NULL) { CLEAR_UDP_PACKET(p); } - p->pppoesh = NULL; p->pppoedh = NULL; p->payload = NULL; p->payload_len = 0;