==== busy-rdomains ==== # Check if rdomains are busy. ==== ifconfig ==== sleep 2 # XXX doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni' *** Error 1 in target 'stamp-stop' (ignored) rm -f stamp-bpf* # Destroy interfaces. doas -n /sbin/ifconfig lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo17 inet 127.0.0.17 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo17 destroy doas -n /sbin/ifconfig lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo18 inet 127.0.0.18 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo18 destroy rm -f stamp-ifconfig # Create and configure loopback interfaces. doas -n /sbin/ifconfig lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo17 inet 127.0.0.17 alias doas -n /sbin/route -n -T 17 add -inet -host 10.6.6.6 127.0.0.1 add host 10.6.6.6: gateway 127.0.0.1 doas -n /sbin/route -n -T 17 add -inet -host 10.7.7.7 127.0.0.1 add host 10.7.7.7: gateway 127.0.0.1 doas -n /sbin/ifconfig lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo18 inet 127.0.0.18 alias doas -n /sbin/route -n -T 18 add -inet -host 10.6.6.6 127.0.0.1 add host 10.6.6.6: gateway 127.0.0.1 doas -n /sbin/route -n -T 18 add -inet -host 10.7.7.7 127.0.0.1 add host 10.7.7.7: gateway 127.0.0.1 doas -n /sbin/route -n -T 17 add -inet -host 127.0.0.18 127.0.0.1 add host 127.0.0.18: gateway 127.0.0.1 doas -n /sbin/route -n -T 18 add -inet -host 127.0.0.17 127.0.0.1 add host 127.0.0.17: gateway 127.0.0.1 # Wait until IPv6 addresses are no longer tentative. for i in `jot 50`; do if ! { /sbin/ifconfig lo17; /sbin/ifconfig lo18; } | fgrep -q tentative; then break; fi; sleep .1; done ! { /sbin/ifconfig lo17; /sbin/ifconfig lo18; } | fgrep tentative ==== pfctl ==== # Create python include file containing the addresses. rm -f addr.py addr.py.tmp echo 'N1="17"' >>addr.py.tmp echo 'IF_N1="lo17"' >>addr.py.tmp echo 'ADDR_N1="127.0.0.17"' >>addr.py.tmp echo 'N2="18"' >>addr.py.tmp echo 'IF_N2="lo18"' >>addr.py.tmp echo 'ADDR_N2="127.0.0.18"' >>addr.py.tmp mv addr.py.tmp addr.py # Load the pf rules into the kernel. cat addr.py /home/src/regress/sys/net/loop/pf.conf | /sbin/pfctl -n -f - cat addr.py /home/src/regress/sys/net/loop/pf.conf | doas -n /sbin/pfctl -a regress -f - ==== run-ping-local-17 ==== rm -f lo17.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo17' || true doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo17 >lo17.tcpdump & rm -f stamp-stop rm -f lo18.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo18' || true tcpdump: listening on lo17, link-type LOOP doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo18 >lo18.tcpdump & rm -f stamp-stop sleep 2 # XXX tcpdump: listening on lo18, link-type LOOP # Ping localhost in routing domain 17. /sbin/ping -n -w 1 -c 1 -V 17 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.092 ms --- 127.0.0.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.092/0.092/0.092/0.000 ms ==== run-ping-loop-17 ==== # Ping non existing address with loopback route in routing domain 17. ! /sbin/ping -n -w 1 -c 1 -V 17 10.6.6.6 PING 10.6.6.6 (10.6.6.6): 56 data bytes --- 10.6.6.6 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss ==== run-ping-address-17 ==== # Ping local address in routing domain 17. /sbin/ping -n -w 1 -c 1 -V 17 127.0.0.17 PING 127.0.0.17 (127.0.0.17): 56 data bytes 64 bytes from 127.0.0.17: icmp_seq=0 ttl=255 time=0.086 ms --- 127.0.0.17 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.086/0.086/0.086/0.000 ms ==== run-ping-local-18 ==== # Ping localhost in routing domain 18. /sbin/ping -n -w 1 -c 1 -V 18 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.086 ms --- 127.0.0.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.086/0.086/0.086/0.000 ms ==== run-ping-loop-18 ==== # Ping non existing address with loopback route in routing domain 18. ! /sbin/ping -n -w 1 -c 1 -V 18 10.6.6.6 PING 10.6.6.6 (10.6.6.6): 56 data bytes --- 10.6.6.6 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss ==== run-ping-address-18 ==== # Ping local address in routing domain 18. /sbin/ping -n -w 1 -c 1 -V 18 127.0.0.18 PING 127.0.0.18 (127.0.0.18): 56 data bytes 64 bytes from 127.0.0.18: icmp_seq=0 ttl=255 time=0.091 ms --- 127.0.0.18 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.091/0.091/0.091/0.000 ms ==== run-ping-rdomain-pass ==== # Pass ping packets between routing domains with pf rule. /sbin/ping -n -w 1 -c 1 -V 17 127.0.0.18 PING 127.0.0.18 (127.0.0.18): 56 data bytes 64 bytes from 127.0.0.18: icmp_seq=0 ttl=255 time=0.092 ms --- 127.0.0.18 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.092/0.092/0.092/0.000 ms ==== run-ping-rdomain-block ==== # Check that reverse direction without pf rule is not allowed. ! /sbin/ping -n -w 1 -c 1 -V 18 127.0.0.17 PING 127.0.0.17 (127.0.0.17): 56 data bytes --- 127.0.0.17 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss ==== run-ping-rdomain-loop ==== # Ping non existing address and loop between routing domains. ! /sbin/ping -n -w 1 -c 1 -V 17 10.7.7.7 PING 10.7.7.7 (10.7.7.7): 56 data bytes --- 10.7.7.7 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss ==== run-bpf-local-17 ==== sleep 2 # XXX doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni' 488 packets received by filter 489 packets received by filter 0 packets dropped by kernel 0 packets dropped by kernel rm -f stamp-bpf* # Check that the ping packet went through loopback. grep '127.0.0.1 > 127.0.0.1: icmp: echo request' lo17.tcpdump 04:50:50.773742 127.0.0.1 > 127.0.0.1: icmp: echo request (id:c190 seq:0) [icmp cksum ok] (ttl 255, id 17217, len 84, bad ip cksum 0! -> 7a65) ==== run-bpf-loop-17 ==== # Check that the ping packet went multiple times through loopback. grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .*ttl 255,' lo17.tcpdump 04:50:50.857023 127.0.0.1 > 10.6.6.6: icmp: echo request (id:0334 seq:0) [icmp cksum ok] (ttl 255, id 36755, len 84, bad ip cksum 0! -> 9d08) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 04:50:50.858736 127.0.0.1 > 10.6.6.6: icmp: echo request (id:0334 seq:0) [icmp cksum ok] [ttl 1] (id 36755, len 84, bad ip cksum 0! -> 9b09) ==== run-bpf-local-18 ==== # Check that the ping packet went through loopback. grep '127.0.0.1 > 127.0.0.1: icmp: echo request' lo18.tcpdump 04:50:53.037001 127.0.0.1 > 127.0.0.1: icmp: echo request (id:a15a seq:0) [icmp cksum ok] (ttl 255, id 27213, len 84, bad ip cksum 0! -> 5359) ==== run-bpf-loop-18 ==== # Check that the ping packet went multiple times through loopback. grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .*ttl 255,' lo18.tcpdump 04:50:53.121359 127.0.0.1 > 10.6.6.6: icmp: echo request (id:c22a seq:0) [icmp cksum ok] (ttl 255, id 9175, len 84, bad ip cksum 0! -> 8c5) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo18.tcpdump 04:50:53.123060 127.0.0.1 > 10.6.6.6: icmp: echo request (id:c22a seq:0) [icmp cksum ok] [ttl 1] (id 9175, len 84, bad ip cksum 0! -> 6c6) ==== run-bpf-rdomain-loop-17 ==== # Check the ping packet went multiple times in routing domains. grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 255,' lo17.tcpdump 04:50:57.477726 127.0.0.1 > 10.7.7.7: icmp: echo request (id:ab4b seq:0) [icmp cksum ok] (ttl 255, id 52621, len 84, bad ip cksum 0! -> 5e0c) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 254,' lo17.tcpdump grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 04:50:57.478716 127.0.0.1 > 10.7.7.7: icmp: echo request (id:ab4b seq:0) [icmp cksum ok] [ttl 1] (id 52621, len 84, bad ip cksum 0! -> 5c0d) ==== run-bpf-rdomain-loop-18 ==== # Check the ping packet went multiple times in routing domains. grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 254,' lo18.tcpdump 04:50:57.477743 127.0.0.1 > 10.7.7.7: icmp: echo request (id:ab4b seq:0) [icmp cksum ok] (ttl 254, id 52621, len 84, bad ip cksum 0! -> 5f0c) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo18.tcpdump 04:50:57.478712 127.0.0.1 > 10.7.7.7: icmp: echo request (id:ab4b seq:0) [icmp cksum ok] (ttl 2, id 52621, len 84, bad ip cksum 0! -> 5b0d) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo18.tcpdump ==== unconfig ==== # Destroy interfaces. doas -n /sbin/ifconfig lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo17 inet 127.0.0.17 delete doas -n /sbin/ifconfig lo17 destroy doas -n /sbin/ifconfig lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo18 inet 127.0.0.18 delete doas -n /sbin/ifconfig lo18 destroy rm -f stamp-ifconfig