From b16073892eabd964e22d6c07cffb1b337d3d660e Mon Sep 17 00:00:00 2001 From: Thomas Habets Date: Thu, 13 Jun 2024 20:02:53 +0100 Subject: [PATCH] Add ping mac examples --- tests/run | 14 ++++++++++++-- tests/simplemac_noignore.out | 6 ++++++ tests/simplemac_target.out | 6 ++++++ tests/simplemac_timeout.cap | 4 ++++ tests/simplemac_timeout.out | 5 +++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tests/simplemac_noignore.out create mode 100644 tests/simplemac_target.out create mode 100644 tests/simplemac_timeout.cap create mode 100644 tests/simplemac_timeout.out diff --git a/tests/run b/tests/run index 98bf6cc..ecad699 100755 --- a/tests/run +++ b/tests/run @@ -44,12 +44,14 @@ run_test() { CAP="$(mktemp)" + # TODO: in the future also capture icmp. But we need regex matching for that. ip netns exec arping_test1 \ tcpdump \ -s0 \ -nlpi veth1 \ --immediate-mode \ - -w "${CAP?}" arp \ + -w "${CAP?}" \ + arp \ 2>/dev/null & PID=$! @@ -100,11 +102,19 @@ run_tests() { run_test "h" 0 -h run_test "help" 0 --help - # Simple examples. + # Simple IP examples. run_test "simple" 0 -c 1 192.0.2.101 run_test "simple_verbose" 0 -v -c 1 192.0.2.101 run_test "no_reply" 1 -c 1 192.0.2.1 + # Simple MAC examples. + run_test "simplemac_timeout" 1 -c 1 -i veth0 00:01:02:33:44:01 + run_test "simplemac_target" 0 -c 1 -T 192.0.2.101 00:01:02:33:44:01 + + ip netns exec arping_test1 sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0 + run_test "simplemac_noignore" 0 -c 1 -i veth0 00:01:02:33:44:01 + ip netns exec arping_test1 sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1 + # TODO: ping mac address. # -0 diff --git a/tests/simplemac_noignore.out b/tests/simplemac_noignore.out new file mode 100644 index 0000000..4dbff25 --- /dev/null +++ b/tests/simplemac_noignore.out @@ -0,0 +1,6 @@ +ARPING 00:01:02:33:44:01 +62 bytes from 192[.]0[.]2[.]101 \(00:01:02:33:44:01\): icmp_seq=0 time=\d+[.]\d+ usec + +--- 00:01:02:33:44:01 statistics --- +1 packets transmitted, 1 packets received, 0% unanswered \(0 extra\) +rtt min/avg/max/std-dev = 0[.]\d+/0[.]\d+/0[.]\d+/0[.]000 ms diff --git a/tests/simplemac_target.out b/tests/simplemac_target.out new file mode 100644 index 0000000..4dbff25 --- /dev/null +++ b/tests/simplemac_target.out @@ -0,0 +1,6 @@ +ARPING 00:01:02:33:44:01 +62 bytes from 192[.]0[.]2[.]101 \(00:01:02:33:44:01\): icmp_seq=0 time=\d+[.]\d+ usec + +--- 00:01:02:33:44:01 statistics --- +1 packets transmitted, 1 packets received, 0% unanswered \(0 extra\) +rtt min/avg/max/std-dev = 0[.]\d+/0[.]\d+/0[.]\d+/0[.]000 ms diff --git a/tests/simplemac_timeout.cap b/tests/simplemac_timeout.cap new file mode 100644 index 0000000..3411c00 --- /dev/null +++ b/tests/simplemac_timeout.cap @@ -0,0 +1,4 @@ +IP 192.0.2.100 > 255.255.255.255: ICMP echo request, id 27006, seq 0, length 28 + 0x0000: 4500 0030 697e 0000 4001 4eeb c000 0264 + 0x0010: ffff ffff 0800 113f 697e 0000 06f7 0000 + 0x0020: 0000 0000 b25a f716 0000 0000 fabf d219 diff --git a/tests/simplemac_timeout.out b/tests/simplemac_timeout.out new file mode 100644 index 0000000..51ad181 --- /dev/null +++ b/tests/simplemac_timeout.out @@ -0,0 +1,5 @@ +ARPING 00:01:02:33:44:01 +Timeout + +--- 00:01:02:33:44:01 statistics --- +1 packets transmitted, 0 packets received, 100% unanswered \(0 extra\)