bugfix: packet parser adds checks for packets with UDP port 2152 but not GTP-U

This commit is contained in:
luwenpeng
2024-08-14 17:24:26 +08:00
parent 5abf0d7942
commit 42f44b53b1
4 changed files with 304 additions and 22 deletions

View File

@@ -831,12 +831,18 @@ static inline const char *parse_gtp_u(struct packet *pkt, const char *data, uint
return data;
}
uint8_t next_proto = (((const uint8_t *)(data + hdr_len))[0]) >> 4;
if (next_proto != 4 && next_proto != 6)
{
// next_proto is not IPv4 or IPv6, this is not a normal GTP-U packet, fallback to UDP
return data;
}
struct raw_layer *layer = get_free_layer(pkt);
if (unlikely(layer == NULL))
{
return data;
}
uint8_t next_proto = (((const uint8_t *)(data + hdr_len))[0]) >> 4;
SET_LAYER(pkt, layer, LAYER_PROTO_GTP_U, hdr_len, data, len, 0);
switch (next_proto)