Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #624 DLT_NULL/DLT_LOOP support for multi-platform PF_INET6 values #642

Merged
merged 1 commit into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
03/12/2021 Version 4.3.4 Beta1
- Fix gcc 8.3.0 build warnings (#634)
- DLT_NULL/DLT_LOOP support for cross-platform PF_INET6 (#624)
- armv5 Freescale compile (#623)
- heap buffer overflow in tcpreplay fast_edit_packet (#620)
- heap buffer overflow in tcpreplay get_next_packet (#619)
Expand Down
13 changes: 12 additions & 1 deletion src/tcpedit/plugins/dlt_null/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,21 @@ dlt_null_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
if (pktlen < 4)
return TCPEDIT_ERROR;

/* PF_INET is always 2 but PF_INET6 varies based on platform, i.e
* Linux - 10
* NetBSD,OpenBSD,BSD/OS - 24
* NetBSD,OpenBSD,BSD/OS - 28
* Darwin/macOS - 30
* See https://gitlab.com/wireshark/wireshark/-/wikis/NullLoopback
*/
af_type = (uint32_t *)packet;
if (*af_type == PF_INET || SWAPLONG(*af_type) == PF_INET) {
protocol = ETHERTYPE_IP;
} else if (*af_type == PF_INET6 || SWAPLONG(*af_type) == PF_INET6) {
} else if (*af_type == PF_INET6 || SWAPLONG(*af_type) == PF_INET6 ||
*af_type == 10 || SWAPLONG(*af_type) == 10 ||
*af_type == 24 || SWAPLONG(*af_type) == 24 ||
*af_type == 28 || SWAPLONG(*af_type) == 28 ||
*af_type == 30 || SWAPLONG(*af_type) == 30) {
protocol = ETHERTYPE_IP6;
} else {
tcpedit_seterr(ctx->tcpedit, "Unsupported DLT_NULL/DLT_LOOP PF_ type: 0x%04x", *af_type);
Expand Down