==== 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 lo38 rdomain 38 doas -n /sbin/ifconfig lo38 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo38 inet 127.0.0.38 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo38 destroy doas -n /sbin/ifconfig lo39 rdomain 39 doas -n /sbin/ifconfig lo39 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo39 inet 127.0.0.39 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo39 destroy rm -f stamp-ifconfig # Create and configure loopback interfaces. doas -n /sbin/ifconfig lo38 rdomain 38 doas -n /sbin/ifconfig lo38 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo38 inet 127.0.0.38 alias doas -n /sbin/route -n -T 38 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 38 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 lo39 rdomain 39 doas -n /sbin/ifconfig lo39 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo39 inet 127.0.0.39 alias doas -n /sbin/route -n -T 39 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 39 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 38 add -inet -host 127.0.0.39 127.0.0.1 add host 127.0.0.39: gateway 127.0.0.1 doas -n /sbin/route -n -T 39 add -inet -host 127.0.0.38 127.0.0.1 add host 127.0.0.38: gateway 127.0.0.1 # Wait until IPv6 addresses are no longer tentative. for i in `jot 50`; do if ! { /sbin/ifconfig lo38; /sbin/ifconfig lo39; } | fgrep -q tentative; then break; fi; sleep .1; done ! { /sbin/ifconfig lo38; /sbin/ifconfig lo39; } | fgrep tentative ==== pfctl ==== # Create python include file containing the addresses. rm -f addr.py addr.py.tmp echo 'N1="38"' >>addr.py.tmp echo 'IF_N1="lo38"' >>addr.py.tmp echo 'ADDR_N1="127.0.0.38"' >>addr.py.tmp echo 'N2="39"' >>addr.py.tmp echo 'IF_N2="lo39"' >>addr.py.tmp echo 'ADDR_N2="127.0.0.39"' >>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-38 ==== rm -f lo38.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo38' || true doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo38 >lo38.tcpdump & rm -f stamp-stop rm -f lo39.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo39' || true tcpdump: listening on lo38, link-type LOOP doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo39 >lo39.tcpdump & rm -f stamp-stop sleep 2 # XXX tcpdump: listening on lo39, link-type LOOP # Ping localhost in routing domain 38. /sbin/ping -n -w 1 -c 1 -V 38 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.103 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.103/0.103/0.103/0.000 ms ==== run-ping-loop-38 ==== # Ping non existing address with loopback route in routing domain 38. ! /sbin/ping -n -w 1 -c 1 -V 38 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-38 ==== # Ping local address in routing domain 38. /sbin/ping -n -w 1 -c 1 -V 38 127.0.0.38 PING 127.0.0.38 (127.0.0.38): 56 data bytes 64 bytes from 127.0.0.38: icmp_seq=0 ttl=255 time=0.090 ms --- 127.0.0.38 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.090/0.090/0.090/0.000 ms ==== run-ping-local-39 ==== # Ping localhost in routing domain 39. /sbin/ping -n -w 1 -c 1 -V 39 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.087 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.087/0.087/0.087/0.000 ms ==== run-ping-loop-39 ==== # Ping non existing address with loopback route in routing domain 39. ! /sbin/ping -n -w 1 -c 1 -V 39 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-39 ==== # Ping local address in routing domain 39. /sbin/ping -n -w 1 -c 1 -V 39 127.0.0.39 PING 127.0.0.39 (127.0.0.39): 56 data bytes 64 bytes from 127.0.0.39: icmp_seq=0 ttl=255 time=0.084 ms --- 127.0.0.39 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.084/0.084/0.084/0.000 ms ==== run-ping-rdomain-pass ==== # Pass ping packets between routing domains with pf rule. /sbin/ping -n -w 1 -c 1 -V 38 127.0.0.39 PING 127.0.0.39 (127.0.0.39): 56 data bytes 64 bytes from 127.0.0.39: icmp_seq=0 ttl=255 time=0.117 ms --- 127.0.0.39 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.117/0.117/0.117/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 39 127.0.0.38 PING 127.0.0.38 (127.0.0.38): 56 data bytes --- 127.0.0.38 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 38 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-38 ==== 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' lo38.tcpdump 05:06:50.975560 127.0.0.1 > 127.0.0.1: icmp: echo request (id:e64d seq:0) [icmp cksum ok] (ttl 255, id 46316, len 84, bad ip cksum 0! -> 8ba) ==== run-bpf-loop-38 ==== # 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,' lo38.tcpdump 05:06:51.058328 127.0.0.1 > 10.6.6.6: icmp: echo request (id:1c57 seq:0) [icmp cksum ok] (ttl 255, id 61086, len 84, bad ip cksum 0! -> 3dfd) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 05:06:51.059936 127.0.0.1 > 10.6.6.6: icmp: echo request (id:1c57 seq:0) [icmp cksum ok] [ttl 1] (id 61086, len 84, bad ip cksum 0! -> 3bfe) ==== run-bpf-local-39 ==== # Check that the ping packet went through loopback. grep '127.0.0.1 > 127.0.0.1: icmp: echo request' lo39.tcpdump 05:06:53.239568 127.0.0.1 > 127.0.0.1: icmp: echo request (id:f2ff seq:0) [icmp cksum ok] (ttl 255, id 52263, len 84, bad ip cksum 0! -> f17e) ==== run-bpf-loop-39 ==== # 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,' lo39.tcpdump 05:06:53.322555 127.0.0.1 > 10.6.6.6: icmp: echo request (id:9ec4 seq:0) [icmp cksum ok] (ttl 255, id 44139, len 84, bad ip cksum 0! -> 8030) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo39.tcpdump 05:06:53.324171 127.0.0.1 > 10.6.6.6: icmp: echo request (id:9ec4 seq:0) [icmp cksum ok] [ttl 1] (id 44139, len 84, bad ip cksum 0! -> 7e31) ==== run-bpf-rdomain-loop-38 ==== # 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,' lo38.tcpdump 05:06:57.680085 127.0.0.1 > 10.7.7.7: icmp: echo request (id:92ce seq:0) [icmp cksum ok] (ttl 255, id 35963, len 84, bad ip cksum 0! -> 9f1e) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 254,' lo38.tcpdump grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 05:06:57.681072 127.0.0.1 > 10.7.7.7: icmp: echo request (id:92ce seq:0) [icmp cksum ok] [ttl 1] (id 35963, len 84, bad ip cksum 0! -> 9d1f) ==== run-bpf-rdomain-loop-39 ==== # 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,' lo39.tcpdump 05:06:57.680104 127.0.0.1 > 10.7.7.7: icmp: echo request (id:92ce seq:0) [icmp cksum ok] (ttl 254, id 35963, len 84, bad ip cksum 0! -> a01e) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo39.tcpdump 05:06:57.681069 127.0.0.1 > 10.7.7.7: icmp: echo request (id:92ce seq:0) [icmp cksum ok] (ttl 2, id 35963, len 84, bad ip cksum 0! -> 9c1f) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo39.tcpdump ==== unconfig ==== # Destroy interfaces. doas -n /sbin/ifconfig lo38 rdomain 38 doas -n /sbin/ifconfig lo38 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo38 inet 127.0.0.38 delete doas -n /sbin/ifconfig lo38 destroy doas -n /sbin/ifconfig lo39 rdomain 39 doas -n /sbin/ifconfig lo39 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo39 inet 127.0.0.39 delete doas -n /sbin/ifconfig lo39 destroy rm -f stamp-ifconfig