==== 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.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-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.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.090 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.090/0.090/0.090/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.105 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.105/0.105/0.105/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' 464 packets received by filter 458 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:55.157271 127.0.0.1 > 127.0.0.1: icmp: echo request (id:9b36 seq:0) [icmp cksum ok] (ttl 255, id 1935, len 84, bad ip cksum 0! -> b617) ==== 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:55.239538 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e199 seq:0) [icmp cksum ok] (ttl 255, id 33375, len 84, bad ip cksum 0! -> aa3c) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 05:06:55.240767 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e199 seq:0) [icmp cksum ok] [ttl 1] (id 33375, len 84, bad ip cksum 0! -> a83d) ==== 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:57.416392 127.0.0.1 > 127.0.0.1: icmp: echo request (id:a569 seq:0) [icmp cksum ok] (ttl 255, id 37058, len 84, bad ip cksum 0! -> 2ce4) ==== 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:57.501392 127.0.0.1 > 10.6.6.6: icmp: echo request (id:de0d seq:0) [icmp cksum ok] (ttl 255, id 62467, len 84, bad ip cksum 0! -> 3898) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo39.tcpdump 05:06:57.502597 127.0.0.1 > 10.6.6.6: icmp: echo request (id:de0d seq:0) [icmp cksum ok] [ttl 1] (id 62467, len 84, bad ip cksum 0! -> 3699) ==== 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:07:01.860937 127.0.0.1 > 10.7.7.7: icmp: echo request (id:af0d seq:0) [icmp cksum ok] (ttl 255, id 20373, len 84, bad ip cksum 0! -> dc04) ! 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:07:01.861864 127.0.0.1 > 10.7.7.7: icmp: echo request (id:af0d seq:0) [icmp cksum ok] [ttl 1] (id 20373, len 84, bad ip cksum 0! -> da05) ==== 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:07:01.860955 127.0.0.1 > 10.7.7.7: icmp: echo request (id:af0d seq:0) [icmp cksum ok] (ttl 254, id 20373, len 84, bad ip cksum 0! -> dd04) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo39.tcpdump 05:07:01.861861 127.0.0.1 > 10.7.7.7: icmp: echo request (id:af0d seq:0) [icmp cksum ok] (ttl 2, id 20373, len 84, bad ip cksum 0! -> d905) ! 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