[PATCH v2] pcapng: allow any protocol link type for the interface block

Stephen Hemminger stephen at networkplumber.org
Fri Sep 26 02:04:47 CEST 2025


On Wed, 27 Aug 2025 16:32:15 -0600
Schneide <schneide at qti.qualcomm.com> wrote:

>  
> +* pcapng: Changed the API for adding interfaces to include a link type argument.
> +  The link type was previously hardcoded to the ethernet link type in the API.
> +  This argument is added to ``rte_pcapng_add_interface``.
> +  These functions are versioned to retain binary compatibility until the next LTS release.

Since link connector is now merged, and that wording might overlap and
be confusing. Would be could to add reference to pcap-linktype.7 man
page. 

Also, google search showed a related draft RFC.

 https://datatracker.ietf.org/doc/draft-ietf-opsawg-pcaplinktype/

In that RFC, the defines are LINKTYPE_XXX maybe that would be better
and break the dependency on libpcap for values. That means values will
come from IANA in future.

The enum (thanks to ChatGPT) for RFC draft would be:

typedef enum pcap_linktype {
    LINKTYPE_NULL               = 0,    /* BSD loopback encapsulation */  
    LINKTYPE_ETHERNET           = 1,    /* IEEE 802.3 Ethernet */
    LINKTYPE_EXP_ETHERNET       = 2,    /* Xerox experimental 3Mb Ethernet */
    LINKTYPE_AX25               = 3,    /* AX.25 layer 2 packets */
    LINKTYPE_PRONET             = 4,    /* Proteon PRONet Token Ring (reserved) */
    LINKTYPE_CHAOS              = 5,    /* MIT Chaosnet (reserved) */
    LINKTYPE_IEEE802_5          = 6,    /* IEEE 802.5 Token Ring */
    LINKTYPE_ARCNET_BSD         = 7,    /* ARCNET with BSD encapsulation */
    LINKTYPE_SLIP               = 8,    /* SLIP, with a direction header */
    LINKTYPE_PPP                = 9,    /* PPP */
    LINKTYPE_FDDI               = 10,   /* FDDI (ANSI INCITS 239-1994) */

    /* 11–49: not available for assignment (reserved) */

    LINKTYPE_PPP_HDLC           = 50,   /* PPP in HDLC-like framing */
    LINKTYPE_PPP_ETHER          = 51,   /* PPPoE session packets */

    /* 52–98: not available for assignment */

    LINKTYPE_SYMANTEC_FIREWALL  = 99,   /* Reserved for Symantec Enterprise Firewall */
    LINKTYPE_ATM_RFC1483        = 100,  /* LLC/SNAP-encapsulated ATM */
    LINKTYPE_RAW                 = 101,  /* Raw IP (starts with IP header) */
    LINKTYPE_SLIP_BSDOS          = 102,  /* BSD/OS SLIP BPF header (reserved) */
    LINKTYPE_PPP_BSDOS           = 103,  /* BSD/OS PPP BPF header (reserved) */
    LINKTYPE_C_HDLC              = 104,  /* Cisco PPP with HDLC framing */
    LINKTYPE_IEEE802_11          = 105,  /* IEEE 802.11 wireless LAN */
    LINKTYPE_ATM_CLIP             = 106,  /* Classical IP, no header before IP */
    LINKTYPE_FRELAY               = 107,  /* Frame Relay LAPF */
    LINKTYPE_LOOP                 = 108,  /* OpenBSD loopback encapsulation */
    LINKTYPE_ENC                  = 109,  /* OpenBSD IPsec encapsulation (reserved) */
    LINKTYPE_LANE8023             = 110,  /* ATM LANE + 802.3 (reserved) */
    LINKTYPE_HIPPI                 = 111,  /* NetBSD HIPPI (reserved) */
    LINKTYPE_HDLC                  = 112,  /* NetBSD HDLC framing (reserved) */
    LINKTYPE_LINUX_SLL              = 113,  /* Linux “cooked” capture encapsulation */
    LINKTYPE_LTALK                   = 114,  /* Apple LocalTalk */
    LINKTYPE_ECONET                   = 115,  /* Acorn Econet (reserved) */
    LINKTYPE_IPFILTER                  = 116,  /* OpenBSD ipfilter (reserved) */
    LINKTYPE_PFLOG                       = 117,  /* PF logging (reserved) */
    LINKTYPE_CISCO_IOS                     = 118,  /* Cisco internal use (reserved) */
    LINKTYPE_IEEE802_11_PRISM                = 119,  /* 802.11 + Prism monitor header */
    LINKTYPE_IEEE802_11_AIRONET                = 120,  /* 802.11 + Aironet metadata (reserved) */
    LINKTYPE_HHDLC                             = 121,  /* Siemens HiPath HDLC (reserved) */
    LINKTYPE_IP_OVER_FC                        = 122,  /* IP and ATM over Fibre Channel */
    LINKTYPE_SUNATM                              = 123,  /* ATM from SunATM */
    LINKTYPE_RIO                                    = 124,  /* RapidIO (reserved) */
    LINKTYPE_PCI_EXP                                = 125,  /* PCI Express (reserved) */
    LINKTYPE_AURORA                                   = 126,  /* Xilinx Aurora link (reserved) */
    LINKTYPE_IEEE802_11_RADIOTAP                       = 127,  /* 802.11 + Radiotap header */
    LINKTYPE_TZSP                                        = 128,  /* Tazmen Sniffer Protocol (reserved) */
    LINKTYPE_ARCNET_LINUX                                  = 129,  /* ARCNET, Linux encapsulation */
    LINKTYPE_JUNIPER_MLPPP                                   = 130,
    LINKTYPE_JUNIPER_MLFR                                    = 131,
    LINKTYPE_JUNIPER_ES                                     = 132,
    LINKTYPE_JUNIPER_GGSN                                   = 133,
    LINKTYPE_JUNIPER_MFR                                    = 134,
    LINKTYPE_JUNIPER_ATM2                                   = 135,
    /* … and so on, up to LINKTYPE_DECT_NR = 301 in the initial set … */
    LINKTYPE_DOCSIS                                        = 143,  /* DOCSIS MAC frames */
    LINKTYPE_LINUX_IRDA                                    = 144,
    LINKTYPE_IBM_SP                                          = 145,
    LINKTYPE_IBM_SN                                           = 146,
    LINKTYPE_RESERVED_01                                      = 147,  /* deprecated private use */
    LINKTYPE_RESERVED_02                                      = 148,
    LINKTYPE_RESERVED_03                                      = 149,
    /* ... through LINKTYPE_RESERVED_15 (i.e. up to 162) ... */
    LINKTYPE_ZWAVE_TAP                                       = 297,
    LINKTYPE_SILABS_DEBUG_CHANNEL                            = 298,
    LINKTYPE_FIRA_UCI                                        = 299,
    LINKTYPE_MDB                                              = 300,
    LINKTYPE_DECT_NR                                          = 301,

    /* Experimental / Private-Use range begins at 65001..65535 */
} LinkType;









More information about the dev mailing list