This commit is contained in:
Adv2924 2026-05-09 23:44:24 +05:30 committed by GitHub
commit e57c7a1804
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3112,15 +3112,27 @@ icmpbad:
} else {
/* UNKNOWN PROTOCOL **********************************************************/
const char *hdrstr;
hdrstr = nexthdrtoa(hdr.proto, 1);
if (hdrstr == NULL || *hdrstr == '\0') {
Snprintf(protoinfo, sizeof(protoinfo), "Unknown protocol (%d) %s > %s: %s",
hdr.proto, srchost, dsthost, ipinfo);
/* Check if the ip version is 6 using the hdr struct*/
if (hdr.version == 6) {
/* It's an IPv6 packet */
if (hdrstr == NULL || *hdrstr == '\0') {
Snprintf(protoinfo, sizeof(protoinfo), "IPv6 (nh=%d) %s > %s: %s",
hdr.proto, srchost, dsthost, ipinfo);
} else {
Snprintf(protoinfo, sizeof(protoinfo), "IPv6 (nh=%s/%d) %s > %s: %s",
hdrstr, hdr.proto, srchost, dsthost, ipinfo);
}
} else {
Snprintf(protoinfo, sizeof(protoinfo), "%s (%d) %s > %s: %s",
hdrstr, hdr.proto, srchost, dsthost, ipinfo);
}
if (hdrstr == NULL || *hdrstr == '\0') {
Snprintf(protoinfo, sizeof(protoinfo), "Unknown protocol (%d) %s > %s: %s",
hdr.proto, srchost, dsthost, ipinfo);
} else {
Snprintf(protoinfo, sizeof(protoinfo), "%s (%d) %s > %s: %s",
hdrstr, hdr.proto, srchost, dsthost, ipinfo);
}
}
}
return protoinfo;