bpftool-net.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ================
  2. bpftool-net
  3. ================
  4. -------------------------------------------------------------------------------
  5. tool for inspection of netdev/tc related bpf prog attachments
  6. -------------------------------------------------------------------------------
  7. :Manual section: 8
  8. SYNOPSIS
  9. ========
  10. **bpftool** [*OPTIONS*] **net** *COMMAND*
  11. *OPTIONS* := { [{ **-j** | **--json** }] [{ **-p** | **--pretty** }] }
  12. *COMMANDS* :=
  13. { **show** | **list** } [ **dev** name ] | **help**
  14. NET COMMANDS
  15. ============
  16. | **bpftool** **net { show | list } [ dev name ]**
  17. | **bpftool** **net help**
  18. DESCRIPTION
  19. ===========
  20. **bpftool net { show | list } [ dev name ]**
  21. List bpf program attachments in the kernel networking subsystem.
  22. Currently, only device driver xdp attachments and tc filter
  23. classification/action attachments are implemented, i.e., for
  24. program types **BPF_PROG_TYPE_SCHED_CLS**,
  25. **BPF_PROG_TYPE_SCHED_ACT** and **BPF_PROG_TYPE_XDP**.
  26. For programs attached to a particular cgroup, e.g.,
  27. **BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_TYPE_CGROUP_SOCK**,
  28. **BPF_PROG_TYPE_SOCK_OPS** and **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**,
  29. users can use **bpftool cgroup** to dump cgroup attachments.
  30. For sk_{filter, skb, msg, reuseport} and lwt/seg6
  31. bpf programs, users should consult other tools, e.g., iproute2.
  32. The current output will start with all xdp program attachments, followed by
  33. all tc class/qdisc bpf program attachments. Both xdp programs and
  34. tc programs are ordered based on ifindex number. If multiple bpf
  35. programs attached to the same networking device through **tc filter**,
  36. the order will be first all bpf programs attached to tc classes, then
  37. all bpf programs attached to non clsact qdiscs, and finally all
  38. bpf programs attached to root and clsact qdisc.
  39. **bpftool net help**
  40. Print short help message.
  41. OPTIONS
  42. =======
  43. -h, --help
  44. Print short generic help message (similar to **bpftool help**).
  45. -v, --version
  46. Print version number (similar to **bpftool version**).
  47. -j, --json
  48. Generate JSON output. For commands that cannot produce JSON, this
  49. option has no effect.
  50. -p, --pretty
  51. Generate human-readable JSON output. Implies **-j**.
  52. EXAMPLES
  53. ========
  54. | **# bpftool net**
  55. ::
  56. xdp:
  57. eth0(2) driver id 198
  58. tc:
  59. eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act []
  60. eth0(2) clsact/ingress fbflow_icmp id 130246 act []
  61. eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726
  62. eth0(2) clsact/egress cls_fg_dscp id 108619 act []
  63. eth0(2) clsact/egress fbflow_egress id 130245
  64. |
  65. | **# bpftool -jp net**
  66. ::
  67. [{
  68. "xdp": [{
  69. "devname": "eth0",
  70. "ifindex": 2,
  71. "mode": "driver",
  72. "id": 198
  73. }
  74. ],
  75. "tc": [{
  76. "devname": "eth0",
  77. "ifindex": 2,
  78. "kind": "htb",
  79. "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
  80. "id": 111727,
  81. "act": []
  82. },{
  83. "devname": "eth0",
  84. "ifindex": 2,
  85. "kind": "clsact/ingress",
  86. "name": "fbflow_icmp",
  87. "id": 130246,
  88. "act": []
  89. },{
  90. "devname": "eth0",
  91. "ifindex": 2,
  92. "kind": "clsact/egress",
  93. "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
  94. "id": 111726,
  95. },{
  96. "devname": "eth0",
  97. "ifindex": 2,
  98. "kind": "clsact/egress",
  99. "name": "cls_fg_dscp",
  100. "id": 108619,
  101. "act": []
  102. },{
  103. "devname": "eth0",
  104. "ifindex": 2,
  105. "kind": "clsact/egress",
  106. "name": "fbflow_egress",
  107. "id": 130245,
  108. }
  109. ]
  110. }
  111. ]
  112. SEE ALSO
  113. ========
  114. **bpf**\ (2),
  115. **bpf-helpers**\ (7),
  116. **bpftool**\ (8),
  117. **bpftool-prog**\ (8),
  118. **bpftool-map**\ (8),
  119. **bpftool-cgroup**\ (8),
  120. **bpftool-perf**\ (8)