Skip to content

Commit

Permalink
decode/ppp: remove ppph check in favor of flag
Browse files Browse the repository at this point in the history
As we now support variable size headers, we can't use the old pointer.

Replace with a flag.
  • Loading branch information
victorjulien committed Apr 15, 2024
1 parent 68092ff commit 6067955
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/decode-ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
}
case IPPROTO_IP:
/* check PPP VJ uncompressed packets and decode tcp dummy */
if(p->ppph != NULL && SCNtohs(p->ppph->protocol) == PPP_VJ_UCOMP) {
if (p->flags & PKT_PPP_VJ_UCOMP) {
DecodeTCP(tv, dtv, p, pkt + IPV4_GET_HLEN(p),
IPV4_GET_IPLEN(p) - IPV4_GET_HLEN(p));
}
Expand Down
1 change: 1 addition & 0 deletions src/decode-ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static int DecodePPPCompressedProto(ThreadVars *tv, DecodeThreadVars *dtv, Packe
}

if (likely(IPV4_GET_RAW_VER((IPV4Hdr *)(pkt + data_offset)) == 4)) {
p->flags |= PKT_PPP_VJ_UCOMP;
return DecodeIPV4(tv, dtv, p, pkt + data_offset, (uint16_t)(len - data_offset));
} else
return TM_ECODE_FAILED;
Expand Down
3 changes: 2 additions & 1 deletion src/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ void DecodeUnregisterCounters(void);

/** Flag to indicate that packet header or contents should not be inspected */
#define PKT_NOPACKET_INSPECTION BIT_U32(0)
// vacancy
/** Packet has a PPP_VJ_UCOMP header */
#define PKT_PPP_VJ_UCOMP BIT_U32(1)

/** Flag to indicate that packet contents should not be inspected */
#define PKT_NOPAYLOAD_INSPECTION BIT_U32(2)
Expand Down

0 comments on commit 6067955

Please sign in to comment.