wiki:AddingNewLinktype

Version 3 (modified by perry, 14 years ago) (diff)

discuss ARPHRD's

Steps for adding full support for a new Link type to libtrace:

  1. Get a TRACE_TYPE assigned and add it to libtrace.h
  2. Add conversions to/from your linktype
    • If your linktype is supported by pcap:
      • add LIBTRACE_DLT of the correct number to libtrace.h
      • Add your new TRACE_TYPE to libtrace_to_pcap_dlt/pcap_dlt_to_libtrace
    • If your linktype is supported by ERF
      • Add TYPE_* of the correct number to libtrace.h
      • Add your new TRACE_TYPE to libtrace_to_erf_type/erf_type_to_libtrace
    • If your linktype is supported by the Linux kernel:
      • Add your linktype to linuxnative_get_link_type. ARPHRD's are defined in <net/if_arp.h>. If your linktype is too new to exist in that header, consider having
          #ifndef ARPHRD_foo
          #define ARPHRD_foo 1337
          #endif
        
  3. Add a structure to parse your linktype to libtrace.h with a name "libtrace_yourlinktype_t"
  4. Add trace_get_payload_from_yourlinktype to protocols.c, and add code to trace_get_payload_from_link() to understand your linktype.
  5. Add a protocol description to libpacketdump/