Optimize GTP utility functions

This commit is contained in:
luwenpeng
2024-07-11 14:19:38 +08:00
parent d816ad058f
commit 6d552acfd0
6 changed files with 69 additions and 45 deletions

View File

@@ -242,6 +242,8 @@ static inline void gtp2_hdr_set_spare(struct gtp2_hdr *gtp, uint8_t spare)
static inline int gtp2_hdr_to_str(const struct gtp2_hdr *gtp, char *buf, size_t len)
{
memset(buf, 0, len);
int used = 0;
used += snprintf(buf + used, len - used, "GTP: flags=0x%02x (version=%u, piggyback=%u, teid_flag=%u, spare_flag=%u), msg_type=0x%02x, msg_len=%u",
gtp2_hdr_get_flags(gtp),