==== 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.096 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.096/0.096/0.096/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.091 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.091/0.091/0.091/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.090 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.090/0.090/0.090/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.089 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.089/0.089/0.089/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 04:29:20.998430 127.0.0.1 > 127.0.0.1: icmp: echo request (id:e560 seq:0) [icmp cksum ok] (ttl 255, id 30068, len 84, bad ip cksum 0! -> 4832) ==== 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 04:29:21.083309 127.0.0.1 > 10.6.6.6: icmp: echo request (id:6658 seq:0) [icmp cksum ok] (ttl 255, id 42553, len 84, bad ip cksum 0! -> 8662) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 04:29:21.084872 127.0.0.1 > 10.6.6.6: icmp: echo request (id:6658 seq:0) [icmp cksum ok] [ttl 1] (id 42553, len 84, bad ip cksum 0! -> 8463) ==== 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 04:29:23.261796 127.0.0.1 > 127.0.0.1: icmp: echo request (id:23d8 seq:0) [icmp cksum ok] (ttl 255, id 52439, len 84, bad ip cksum 0! -> f0ce) ==== 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 04:29:23.346539 127.0.0.1 > 10.6.6.6: icmp: echo request (id:8da1 seq:0) [icmp cksum ok] (ttl 255, id 6569, len 84, bad ip cksum 0! -> 12f3) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo39.tcpdump 04:29:23.348119 127.0.0.1 > 10.6.6.6: icmp: echo request (id:8da1 seq:0) [icmp cksum ok] [ttl 1] (id 6569, len 84, bad ip cksum 0! -> 10f4) ==== 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 04:29:27.702551 127.0.0.1 > 10.7.7.7: icmp: echo request (id:904f seq:0) [icmp cksum ok] (ttl 255, id 59887, len 84, bad ip cksum 0! -> 41aa) ! 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 04:29:27.703479 127.0.0.1 > 10.7.7.7: icmp: echo request (id:904f seq:0) [icmp cksum ok] [ttl 1] (id 59887, len 84, bad ip cksum 0! -> 3fab) ==== 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 04:29:27.702568 127.0.0.1 > 10.7.7.7: icmp: echo request (id:904f seq:0) [icmp cksum ok] (ttl 254, id 59887, len 84, bad ip cksum 0! -> 42aa) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo39.tcpdump 04:29:27.703476 127.0.0.1 > 10.7.7.7: icmp: echo request (id:904f seq:0) [icmp cksum ok] (ttl 2, id 59887, len 84, bad ip cksum 0! -> 3eab) ! 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