==== 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.104 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.104/0.104/0.104/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.086 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.086/0.086/0.086/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.086 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.086/0.086/0.086/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.110 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.110/0.110/0.110/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 10:26:18.493120 127.0.0.1 > 127.0.0.1: icmp: echo request (id:699a seq:0) [icmp cksum ok] (ttl 255, id 40954, len 84, bad ip cksum 0! -> 1dac) ==== 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 10:26:18.576610 127.0.0.1 > 10.6.6.6: icmp: echo request (id:2df9 seq:0) [icmp cksum ok] (ttl 255, id 10802, len 84, bad ip cksum 0! -> 26a) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo38.tcpdump 10:26:18.578214 127.0.0.1 > 10.6.6.6: icmp: echo request (id:2df9 seq:0) [icmp cksum ok] [ttl 1] (id 10802, len 84, bad ip cksum 0! -> 6b) ==== 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 10:26:20.754471 127.0.0.1 > 127.0.0.1: icmp: echo request (id:1dad seq:0) [icmp cksum ok] (ttl 255, id 33485, len 84, bad ip cksum 0! -> 3ad9) ==== 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 10:26:20.838500 127.0.0.1 > 10.6.6.6: icmp: echo request (id:221e seq:0) [icmp cksum ok] (ttl 255, id 29931, len 84, bad ip cksum 0! -> b7b0) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo39.tcpdump 10:26:20.840097 127.0.0.1 > 10.6.6.6: icmp: echo request (id:221e seq:0) [icmp cksum ok] [ttl 1] (id 29931, len 84, bad ip cksum 0! -> b5b1) ==== 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 10:26:25.196633 127.0.0.1 > 10.7.7.7: icmp: echo request (id:c6db seq:0) [icmp cksum ok] (ttl 255, id 38582, len 84, bad ip cksum 0! -> 94e3) ! 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 10:26:25.197590 127.0.0.1 > 10.7.7.7: icmp: echo request (id:c6db seq:0) [icmp cksum ok] [ttl 1] (id 38582, len 84, bad ip cksum 0! -> 92e4) ==== 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 10:26:25.196650 127.0.0.1 > 10.7.7.7: icmp: echo request (id:c6db seq:0) [icmp cksum ok] (ttl 254, id 38582, len 84, bad ip cksum 0! -> 95e3) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo39.tcpdump 10:26:25.197586 127.0.0.1 > 10.7.7.7: icmp: echo request (id:c6db seq:0) [icmp cksum ok] (ttl 2, id 38582, len 84, bad ip cksum 0! -> 91e4) ! 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