Comments (3)
xdp-dump already has some examples, or are you thinking of a missing example?
Examples
The below will load the xdp-filter program on eth0, but it does not do any actual filtering:
# xdp-filter load --mode skb eth0
#
# xdpdump -D
if_index if_name XDP program entry function
-------- ---------------- --------------------------------------------------
1 lo <No XDP program loaded!>
2 eth0 xdpfilt_blk_all()
Now we can try xdpdump:
# xdpdump -i eth0
1584373839.460733895: packet size 102 bytes, captured 102 bytes on if_index 2, rx queue 0, @entry
0x0000: 52 54 00 db 44 b6 52 54 00 34 38 da 08 00 45 48 RT..D.RT.48...EH
0x0010: 00 58 d7 dd 40 00 40 06 ec c3 c0 a8 7a 01 c0 a8 .X..@[email protected]...
0x0020: 7a 64 9c de 00 16 0d d5 c6 bc 46 c9 bb 11 80 18 zd........F.....
0x0030: 01 f5 7b b4 00 00 01 01 08 0a 77 0a 8c b8 40 12 ..{.......w...@.
0x0040: cc a6 00 00 00 10 54 ce 6e 20 c3 e7 da 6c 08 42 ......T.n ...l.B
0x0050: d6 d9 ee 42 42 f0 82 c9 4f 12 ed 7b 19 ab 22 0d ...BB...O..{..".
0x0060: 09 29 a9 ee df 89 .)....
1584373839.462340808: packet size 66 bytes, captured 66 bytes on if_index 2, rx queue 0, @entry
0x0000: 52 54 00 db 44 b6 52 54 00 34 38 da 08 00 45 48 RT..D.RT.48...EH
0x0010: 00 34 d7 de 40 00 40 06 ec e6 c0 a8 7a 01 c0 a8 .4..@[email protected]...
0x0020: 7a 64 9c de 00 16 0d d5 c6 e0 46 c9 bc 85 80 10 zd........F.....
0x0030: 01 f5 74 0c 00 00 01 01 08 0a 77 0a 8c ba 40 12 ..t.......w...@.
0x0040: d2 34 .4
^C
2 packets captured
0 packets dropped by perf ring
Below are two more examples redirecting the capture file to tcpdump or tshark:
# xdpdump -i eth0 -w - | tcpdump -r - -n
reading from file -, link-type EN10MB (Ethernet)
15:55:09.075887 IP 192.168.122.1.40928 > 192.168.122.100.ssh: Flags [P.], seq 3857553815:3857553851, ack 3306438882, win 501, options [nop,nop,TS val 1997449167 ecr 1075234328], length 36
15:55:09.077756 IP 192.168.122.1.40928 > 192.168.122.100.ssh: Flags [.], ack 37, win 501, options [nop,nop,TS val 1997449169 ecr 1075244363], length 0
15:55:09.750230 IP 192.168.122.1.40928 > 192.168.122.100.ssh: Flags [P.], seq 36:72, ack 37, win 501, options [nop,nop,TS val 1997449842 ecr 1075244363], length 36
# xdpdump -i eth0 -w - | tshark -r - -n
1 0.000000 192.168.122.1 → 192.168.122.100 SSH 102 Client: Encrypted packet (len=36)
2 0.000646 192.168.122.1 → 192.168.122.100 TCP 66 40158 → 22 [ACK] Seq=37 Ack=37 Win=1467 Len=0 TSval=1997621571 TSecr=1075416765
3 12.218164 192.168.122.1 → 192.168.122.100 SSH 102 Client: Encrypted packet (len=36)
from xdp-tools.
Didn't have anything particular in mind. This came out of the last XDP meeting where I promised the docs people that we would have examples of usage for each tool in the man pages for them to work from. I just opened this issue so we wouldn't forget - if you think the xdpdump examples are sufficient as-is that is fine :)
from xdp-tools.
Didn't have anything particular in mind. This came out of the last XDP meeting where I promised the docs people that we would have examples of usage for each tool in the man pages for them to work from. I just opened this issue so we wouldn't forget - if you think the xdpdump examples are sufficient as-is that is fine :)
Ack, ok will remove me from the assignment list for now!!
from xdp-tools.
Related Issues (20)
- Support force-detaching xdp_link-based attachments
- is libxdp going to support kernel generic attach/detach/query API for multi-progs? HOT 1
- xdp-loader does not work in network namespace? HOT 12
- libxdp without dispatcher HOT 12
- idea to migrate xdp synproxy to xdp-tools or bpf-examaples repo HOT 5
- Request: mechanism to build static libxdp without dispatcher binaries HOT 8
- force xdp-tools to built with static link to libbpf.a and libxdp.a HOT 2
- Ubuntu 22.04 HOT 2
- xdp-filter: support allow/drop of icmp
- does libxdp support bpf tail call another xdp program? HOT 2
- xdp-loader load xdp program with bpf tail call result in Bad file descriptor(-9) HOT 14
- libbpf: prog 'tp_xdp_redirect_err': on hyper-V linux-azure HOT 1
- BPF kfuncs and vmlinux.h HOT 2
- llc: error: llc: xdp-dispatcher.ll:10:40: error: expected type HOT 3
- xsk_umem__create() return -22 HOT 9
- Stack smashing detected HOT 3
- Unable to Compile xdp-tools "libbpf: failed to find BTF for extern 'llvm.bpf.passthrough.p0i32.p0i32': -2" HOT 3
- How to attach same XDP program to multiple interfaces HOT 2
- xsk_socket__create returns succeed, but need to wait extra about 30 seconds to send packages HOT 2
- Compilation error with GCC 14 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdp-tools.