Skip to content

v0.10.0

Compare
Choose a tag to compare
@YutaroHayakawa YutaroHayakawa released this 06 May 04:13
· 6 commits to master since this release

Release Highlight

  • Support "format specifier" in BPF-based extension module
  • Fix a symbol resolution issue when Intel IBT is enabled

Full Change Log: v0.9.0...v0.10.0

Support "format specifier" in the BPF-based extension module

In the BPF-based extension module, we couldn't change the value format. For example, when we want to dump bit flags in human-visible format (such as hex decimal or name of the flags), we can't. This release introduced a new mechanism to specify the value format with a "format specifier" annotation. We can now format your output with a special annotation like this.

struct event {
  __u32 gso_type __ipft_fmt_hex;
} __ipft_event_struct;

The __ipft_fmt_hex formats the value of the gso_type field as hex decimal. This produces the output like this.

809146393994497      004                  vmlinux              dev_hard_start_xmit ( gso_type: 0x1 )

Cool, but we may want to display a more human-readable name. In that case, we can use __ipft_fmt_enum_flags like this.

enum {
  tcpv4           = 1 << 0,
  dodgy           = 1 << 1,
  tcp_ecn         = 1 << 2,
  tcp_fixedid     = 1 << 3,
  tcpv6           = 1 << 4,
  fcoe            = 1 << 5,
  gre             = 1 << 6,
  gre_csum        = 1 << 7,
  ipxip4          = 1 << 8,
  ipxip6          = 1 << 9,
  udp_tunnel      = 1 << 10,
  udp_tunnel_csum = 1 << 11,
  partial         = 1 << 12,
  tunnel_remcsum  = 1 << 13,
  sctp            = 1 << 14,
  esp             = 1 << 15,
  udp             = 1 << 16,
  udp_l4          = 1 << 17,
  flaglist        = 1 << 18,
} __ipft_ref(gso_types);

struct event {
  __u32 gso_type __ipft_fmt_enum_flags(gso_types);
} __ipft_event_struct;

Now we have a new enum annotated with __ipft_ref(gso_types). This annotation makes a "reference" named gso_types and __ipft_fmt_enum_flags refers to that. This produces an output like this.

809146393994497      004                  vmlinux              dev_hard_start_xmit ( gso_type: tcpv4 )
809146393997960      004                     ipip                 ipip_tunnel_xmit ( gso_type: tcpv4 )
809146394001327      004                  vmlinux         iptunnel_handle_offloads ( gso_type: tcpv4 )
809146394004583      004                ip_tunnel                   ip_tunnel_xmit ( gso_type: tcpv4|ipxip4 )
809146394008133      004                ip_tunnel                  tnl_update_pmtu ( gso_type: tcpv4|ipxip4 )

Now we can get more human-readable output. Nice! If the enum is not a bit flag, we also have __ipft_fmt_enum(ref) format specifier.