Skip to content

reg: LinkType(209) resolves to IPMB_LINUX, the name tcpdump and pcapkit both label do-not-use #844

Description

@JarryShaw

Found while researching #842's duplicate-value question. LinkType(209).name returns the
name upstream explicitly says not to use
, and pcapkit's own comment on that member says so
too.

Measured on origin/main (6216de505):

pcapkit/const/reg/linktype.py:421   #: [``DLT_IPMB_LINUX``] Legacy names (do not use) for Linux I2C below.
pcapkit/const/reg/linktype.py:422   IPMB_LINUX = 209
pcapkit/const/reg/linktype.py:424   #: [``DLT_I2C_LINUX``] Linux I2C packets.
pcapkit/const/reg/linktype.py:425   I2C_LINUX = 209

IPMB_LINUX is declared first, so it becomes the canonical member and I2C_LINUX an
alias of it. Live:

LinkType(209).name     -> 'IPMB_LINUX'
LinkType['I2C_LINUX']  -> <LinkType.IPMB_LINUX: 209>

So even asking for the current name hands back the legacy one.

Upstream is unambiguous the other way. libpcap's pcap/dlt.h defines
#define DLT_I2C_LINUX 209 first, then explains: "This was renamed as it's also used for
other protocols, such as Display Data Channel as used by HDMI. We still define
DLT_IPMB_LINUX for backwards source compatibility."
tcpdump.org/linktypes.html labels the
IPMB_LINUX row "Legacy names (do not use)". Wireshark drops the legacy name entirely —
epan/dissectors/packet-pcap_pktdata.c:174 has { 209, "I2C_LINUX" } only.

Cause is mechanical, and datable. The crawler reads linktypes.html row order
(pcapkit/vendor/reg/linktype.py:35) and has no alias or precedence logic. I2C_LINUX
landed first in 78ef9f7a89 (2024-04-27); a later regeneration, cfdf2ab5c7 (2024-05-04),
inserted IPMB_LINUX above it and silently flipped which name Python treats as
canonical. A regression introduced by regeneration, not by a hand edit.

Fix shape: the vendor module needs to emit the current name first when
linktypes.html lists a legacy row above it — or carry an explicit precedence override, since
row order demonstrably does not supply the answer. Regenerating without that change will
reintroduce it.

Separate from #842's register_alias design; this one is wrong regardless of which
convention wins there.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)constRegenerated IANA or vendor constant tables; members keep their numeric valuesfixPull requests that fix a defect (fix: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions