From 670c960b1daf0ffd46643a49b6f88d87d32fd441 Mon Sep 17 00:00:00 2001 From: Gray Liang Date: Sun, 26 Nov 2023 16:04:45 +0800 Subject: [PATCH] debug --- .github/workflows/test.yaml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0a51c3d..8740db7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -69,26 +69,18 @@ jobs: cmd: | chmod +x /host/skbdump/skbdump - - name: Test netns -> 1.1.1.1 + - name: SNAT uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12 with: provision: 'false' cmd: | - sysctl net.ipv4.conf.all.proxy_arp=1 - sysctl net.ipv4.conf.default.proxy_arp=1 + set -ex - ip net a testns - ip l a testns-veth type veth peer name testns-peer - ip l s testns-peer up - ip l s testns-veth netns testns - ip net e testns ip l s testns-veth up - ip r a 10.0.0.1 dev testns-peer - ip net e testns ip a a 10.0.0.1 dev testns-veth - ip net e testns ip r a default dev testns-veth + iptables -t nat -I POSTROUTING 1 -d 1.1.1.1/32 -p tcp --dport 80 -o enp0s2 -j SNAT --to 10.0.0.6:23333 - iptables -t filter --policy FORWARD ACCEPT - iptables -t nat -I POSTROUTING 1 -s 10.0.0.1/24 -o enp0s2 -j MASQUERADE - - /host/skbdump/skbdump --oneshot -i any 'dst host 1.1.1.1 and tcp[tcpflags] = tcp-syn' 2>&1 1>/tmp/log | (read _; sleep 1; ip net e testns curl --connect-timeout 1 1.1.1.1 &>/dev/null || true) + /host/skbdump/skbdump --oneshot -i any -f nf_hook_slow 'dst host 1.1.1.1 and tcp[tcpflags] = tcp-syn' 2>&1 1>/tmp/log | (read _; curl --local-port 8888 1.1.1.1 &>/dev/null || true) cat /tmp/log + cat /tmp/log | grep 'out@' + cat /tmp/log | grep -P 'nf_hook_slow@.*8888>80' + cat /tmp/log | grep -P 'nf_hook_slow+r@*23333>80'