Skip to content

aya: Support TC-style map definitions #156

@d0u9

Description

@d0u9

The Classifier BPF source contains a hashmap in maps section. It is referenced by a program in egress section as documented in tc-bpf manual.

However, when loading via Bpf::load_file(xx), I get an RelocationError saying:

RelocationError { function: "egress", error: SectionNotFound { section_index: 5, symbol_index: 4, symbol_name: Some("config_map") } }

This bpf object can be loaded via tc filter command successfully, and the map can be shown via bpftool map.

output of llvm-readelf -S:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .strtab           STRTAB          0000000000000000 000220 000073 00      0   0  1
  [ 2] .text             PROGBITS        0000000000000000 000040 000000 00  AX  0   0  4
  [ 3] classifier/egress PROGBITS        0000000000000000 000040 0000c8 00  AX  0   0  8
  [ 4] .relclassifier/egress REL         0000000000000000 000200 000010 10     10   3  8
  [ 5] maps              PROGBITS        0000000000000000 000108 000024 00  WA  0   0  4
  [ 6] license           PROGBITS        0000000000000000 00012c 000004 00  WA  0   0  1
  [ 7] .rodata.str1.16   PROGBITS        0000000000000000 000130 000010 01 AMS  0   0 16
  [ 8] .eh_frame         PROGBITS        0000000000000000 000140 000030 00   A  0   0  8
  [ 9] .rel.eh_frame     REL             0000000000000000 000210 000010 10     10   8  8
  [10] .symtab           SYMTAB          0000000000000000 000170 000090 18      1   3  8
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  R (retain), p (processor specific)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ayaThis is about aya (userspace)bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions