==== 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 doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo39 >lo39.tcpdump & rm -f stamp-stop sleep 2 # XXX tcpdump: listening on lo38, link-type LOOP 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.091 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.091/0.091/0.091/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.087 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.087/0.087/0.087/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.085 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.085/0.085/0.085/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.108 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.108/0.108/0.108/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' 489 packets received by filter 488 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:21:09.031228 127.0.0.1 > 127.0.0.1: icmp: echo request (id:ca58 seq:0) [icmp cksum ok] (ttl 255, id 53859, len 84, bad ip cksum 0! -> eb42) ==== 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:21:09.119154 127.0.0.1 > 10.6.6.6: icmp: echo request (id:c120 seq:0) [icmp cksum ok] (ttl 255, id 21010, len 84, bad ip cksum 0! -> da89) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 05:21:09.120758 127.0.0.1 > 10.6.6.6: icmp: echo request (id:c120 seq:0) [icmp cksum ok] [ttl 1] (id 21010, len 84, bad ip cksum 0! -> d88a) ==== 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:21:11.298651 127.0.0.1 > 127.0.0.1: icmp: echo request (id:95b3 seq:0) [icmp cksum ok] (ttl 255, id 55634, len 84, bad ip cksum 0! -> e453) ==== 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:21:11.384750 127.0.0.1 > 10.6.6.6: icmp: echo request (id:379f seq:0) [icmp cksum ok] (ttl 255, id 55005, len 84, bad ip cksum 0! -> 55be) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo39.tcpdump 05:21:11.386375 127.0.0.1 > 10.6.6.6: icmp: echo request (id:379f seq:0) [icmp cksum ok] [ttl 1] (id 55005, len 84, bad ip cksum 0! -> 53bf) ==== 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:21:15.757680 127.0.0.1 > 10.7.7.7: icmp: echo request (id:20c4 seq:0) [icmp cksum ok] (ttl 255, id 20950, len 84, bad ip cksum 0! -> d9c3) ! 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:21:15.758693 127.0.0.1 > 10.7.7.7: icmp: echo request (id:20c4 seq:0) [icmp cksum ok] [ttl 1] (id 20950, len 84, bad ip cksum 0! -> d7c4) ==== 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:21:15.757699 127.0.0.1 > 10.7.7.7: icmp: echo request (id:20c4 seq:0) [icmp cksum ok] (ttl 254, id 20950, len 84, bad ip cksum 0! -> dac3) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo39.tcpdump 05:21:15.758689 127.0.0.1 > 10.7.7.7: icmp: echo request (id:20c4 seq:0) [icmp cksum ok] (ttl 2, id 20950, len 84, bad ip cksum 0! -> d6c4) ! 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