decode/pppoe: localize pppoedh pointer

Remove from Packet struct as there were no users of it.

Ticket: #6938.
pull/10971/head
Victor Julien 2 years ago committed by Victor Julien
parent b4ef910aff
commit b2f7d3604b

@ -59,28 +59,27 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }
p->pppoedh = (PPPOEDiscoveryHdr *)pkt; PPPOEDiscoveryHdr *pppoedh = (PPPOEDiscoveryHdr *)pkt;
/* parse the PPPOE code */ /* parse the PPPOE code */
switch (p->pppoedh->pppoe_code) switch (pppoedh->pppoe_code) {
{ case PPPOE_CODE_PADI:
case PPPOE_CODE_PADI:
break; break;
case PPPOE_CODE_PADO: case PPPOE_CODE_PADO:
break; break;
case PPPOE_CODE_PADR: case PPPOE_CODE_PADR:
break; break;
case PPPOE_CODE_PADS: case PPPOE_CODE_PADS:
break; break;
case PPPOE_CODE_PADT: case PPPOE_CODE_PADT:
break; break;
default: default:
SCLogDebug("unknown PPPOE code: 0x%0"PRIX8"", p->pppoedh->pppoe_code); SCLogDebug("unknown PPPOE code: 0x%0" PRIX8 "", pppoedh->pppoe_code);
ENGINE_SET_INVALID_EVENT(p, PPPOE_WRONG_CODE); ENGINE_SET_INVALID_EVENT(p, PPPOE_WRONG_CODE);
return TM_ECODE_OK; return TM_ECODE_OK;
} }
uint32_t pppoe_length = SCNtohs(p->pppoedh->pppoe_length); uint32_t pppoe_length = SCNtohs(pppoedh->pppoe_length);
uint32_t packet_length = len - PPPOE_DISCOVERY_HEADER_MIN_LEN ; uint32_t packet_length = len - PPPOE_DISCOVERY_HEADER_MIN_LEN ;
SCLogDebug("pppoe_length %"PRIu32", packet_length %"PRIu32"", SCLogDebug("pppoe_length %"PRIu32", packet_length %"PRIu32"",
@ -318,7 +317,6 @@ static int DecodePPPOEtest02 (void)
*/ */
static int DecodePPPOEtest03 (void) static int DecodePPPOEtest03 (void)
{ {
/* example PADO packet taken from RFC2516 */ /* example PADO packet taken from RFC2516 */
uint8_t raw_pppoe[] = { uint8_t raw_pppoe[] = {
0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01,
@ -336,8 +334,8 @@ static int DecodePPPOEtest03 (void)
memset(&tv, 0, sizeof(ThreadVars)); memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe)); int r = DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe));
FAIL_IF_NULL(p->pppoedh); FAIL_IF_NOT(r == TM_ECODE_OK);
SCFree(p); SCFree(p);
PASS; PASS;

@ -87,7 +87,6 @@ enum PktSrcEnum {
#include "decode-ethernet.h" #include "decode-ethernet.h"
#include "decode-gre.h" #include "decode-gre.h"
#include "decode-ppp.h" #include "decode-ppp.h"
#include "decode-pppoe.h"
#include "decode-ipv4.h" #include "decode-ipv4.h"
#include "decode-ipv6.h" #include "decode-ipv6.h"
#include "decode-icmpv4.h" #include "decode-icmpv4.h"
@ -583,7 +582,6 @@ typedef struct Packet_
TCPHdr *tcph; TCPHdr *tcph;
UDPHdr *udph; UDPHdr *udph;
PPPOEDiscoveryHdr *pppoedh;
/* ptr to the payload of the packet /* ptr to the payload of the packet
* with it's length. */ * with it's length. */

@ -121,7 +121,6 @@ void PacketReinit(Packet *p)
if (p->udph != NULL) { if (p->udph != NULL) {
CLEAR_UDP_PACKET(p); CLEAR_UDP_PACKET(p);
} }
p->pppoedh = NULL;
p->payload = NULL; p->payload = NULL;
p->payload_len = 0; p->payload_len = 0;
p->BypassPacketsFlow = NULL; p->BypassPacketsFlow = NULL;

@ -108,6 +108,7 @@
#include "decode-chdlc.h" #include "decode-chdlc.h"
#include "decode-geneve.h" #include "decode-geneve.h"
#include "decode-nsh.h" #include "decode-nsh.h"
#include "decode-pppoe.h"
#include "decode-raw.h" #include "decode-raw.h"
#include "decode-vntag.h" #include "decode-vntag.h"
#include "decode-vxlan.h" #include "decode-vxlan.h"

Loading…
Cancel
Save