Bugfix: packet parser

* Corrected the acquisition of GRE header length
    * Check whether the total length of IP is less than the length of IP header
This commit is contained in:
luwenpeng
2024-06-03 17:50:52 +08:00
parent eb1056b4f9
commit ae2e36b382
3 changed files with 111 additions and 73 deletions

View File

@@ -19,7 +19,7 @@ static int ipv6_proto_to_str(const struct packet_layer *ipv6_layer, char *buff,
switch (next_hdr)
{
case IPPROTO_HOPOPTS:
used += snprintf(buff + used, size - used, ":ipv6.hopopt");
used += snprintf(buff + used, size - used, ":ipv6.hopopts");
break;
case IPPROTO_ROUTING:
used += snprintf(buff + used, size - used, ":ipv6.routing");
@@ -53,7 +53,7 @@ static int packet_proto_to_str(const struct packet *pkt, char *buff, int size)
used += snprintf(buff + used, size - used, "eth:ethertype");
break;
case LAYER_TYPE_PWETH:
used += snprintf(buff + used, size - used, "pweth:ethertype");
used += snprintf(buff + used, size - used, "pwethheuristic:pwethcw");
break;
case LAYER_TYPE_PPP:
used += snprintf(buff + used, size - used, "ppp");