Skip to content

LinkType enum is uint8 but tcpdump defines linktypes > 255 #289

@PaulMcMillan

Description

@PaulMcMillan

The LinkType type is a uint8:
https://github.com/google/gopacket/blob/master/layers/enums.go#L93
However, the canonical list of linktype numbers currently has a max of 266.
http://www.tcpdump.org/linktypes.html

Additionally, looking at the pcap documentation, it looks like that is returned as an int
http://www.tcpdump.org/manpages/pcap_datalink.3pcap.txt
and when we use that function, we also use an int
https://github.com/google/gopacket/blob/master/pcap/pcap.go#L651
Edit: oh, I see how that works. The layers.LinkType() is casting the int to uint8.

I'm also not sure how to solve this in a fully backwards compatible way, but I figured I should bring it up since I noticed it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions