]> The Tcpdump Group git mirrors - libpcap/commit
Redo DLT_/LINKTYPE_ translation.
authorGuy Harris <[email protected]>
Tue, 1 Aug 2023 09:02:56 +0000 (02:02 -0700)
committerGuy Harris <[email protected]>
Tue, 1 Aug 2023 09:02:56 +0000 (02:02 -0700)
commit5daaba1b5d45d111cbd4348d6d4e77fca12953a9
tree9e62c45cd89393e8cfbbbaa82bc27cfc55deabe2
parent193afa491f02dba76ba094b1a6045d548ee37441
Redo DLT_/LINKTYPE_ translation.

Do it with a bunch of ifs rather than with a translation table; that
lets the logic work differently for DLT_ -> LINKTYPE_ mapping and
LINKTYPE_ -> DLT_ mapping.

Have two "matching" ranges, so that the linktypes that preceded the BSDs
all going off in their own directions can be handled as a matching
range.

Avoid doing mapping if the corresponding LINKTYPE_ and DLT_ codes have
the same numerical value.

For LINKTYPE_ -> DLT_ mapping, don't map link-layer type values outside
either of the matching ranges if we don't have a specific mapping set up
for them, just treat the LINKTYPE_ value as if it's a DLT_ value.  That
makes us handle some DLT_ codes outside the high mapping range to which
we assigned matching LINKTYPE_ codes, as well as attempting, as best we
can, files written with platform-dependent DLT_ codes (such as DLT_RAW)
as link-layer type codes (programs *on that platform* will handle them
correctly; programs will not do so on other platforms, but that's better
than not handling them correctly anywhere).

Update various comments.
gencode.c
pcap-common.c
pcap/dlt.h