Refactoring the MPLS utils

This commit is contained in:
luwenpeng
2024-06-05 10:39:57 +08:00
parent ade7b4c8ab
commit a1e693a735
4 changed files with 36 additions and 51 deletions

View File

@@ -464,7 +464,6 @@ static inline uint16_t get_gre_hdr_len(const char *data, uint16_t len)
}
}
}
else if (version == 1)
{
hdr_offset = 8;
@@ -828,7 +827,7 @@ static inline const char *parse_mpls(struct packet *pkt, const char *data, uint1
return data;
}
if (mpls_hdr_get_bos((const struct mpls_hdr *)data))
if (mpls_label_get_bos((const struct mpls_label *)data))
{
SET_LAYER(pkt, layer, LAYER_TYPE_MPLS, 4, data, len, 0);
if (layer->pld_len == 0)
@@ -1384,7 +1383,7 @@ void packet_print_str(const struct packet *pkt)
case LAYER_TYPE_PPPOE:
break;
case LAYER_TYPE_MPLS:
used = mpls_hdr_to_str((const struct mpls_hdr *)layer->hdr_ptr, buffer, sizeof(buffer));
used = mpls_label_to_str((const struct mpls_label *)layer->hdr_ptr, buffer, sizeof(buffer));
break;
break;
case LAYER_TYPE_IPV4: