Add the packet_injector tool to test the packet injection effect

This commit is contained in:
luwenpeng
2024-05-11 18:58:36 +08:00
parent 7f1e7a23de
commit cda77c6f6f
17 changed files with 851 additions and 337 deletions

32
test/README.md Normal file
View File

@@ -0,0 +1,32 @@
# Inject Packet
## 捕包
``` shell
/opt/tsg/mrzcpd/bin/mrpdump -- --pdump "dev_name=nf_0_fw,queue=*" --bpf-rule="host 192.0.2.110 and port 80" --dumpfile-path=/home/admin/fw.pcap
tcpdump -i virtio_dign_c host 192.0.2.110 and port 80 -n -v -w virtio_dign_c.pcap
tcpdump -i virtio_dign_s host 192.0.2.110 and port 80 -n -v -w virtio_dign_s.pcap
```
## 运行
``` shell
./packet_injector -t tcp-rst -c c2s-packet -n 1 # After recv SYN
./packet_injector -t tcp-rst -c s2c-packet -n 1 # After recv SYN-ACK
./packet_injector -t tcp-rst -c c2s-packet -n 2 # After recv Sub-ACK
./packet_injector -t tcp-rst -c c2s-packet -n 3 # After recv First-Payload
```
``` shell
./packet_injector -t tcp-fin -c c2s-packet -n 1 # After recv SYN
./packet_injector -t tcp-fin -c s2c-packet -n 1 # After recv SYN-ACK
./packet_injector -t tcp-fin -c c2s-packet -n 2 # After recv Sub-ACK
./packet_injector -t tcp-fin -c c2s-packet -n 3 # After recv First-Payload
```
## 拨测
``` shell
kubectl -n tsg-os-system exec -it dign-client-9h8rm -c dign-client sh
curl -v http://http.badssl.selftest.gdnt-cloud.website --resolve "http.badssl.selftest.gdnt-cloud.website:80:192.0.2.110"
```