==== 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 lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo17 inet 127.0.0.17 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo17 destroy doas -n /sbin/ifconfig lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo18 inet 127.0.0.18 delete ifconfig: SIOCDIFADDR: Can't assign requested address *** Error 1 in target 'unconfig' (ignored) doas -n /sbin/ifconfig lo18 destroy rm -f stamp-ifconfig # Create and configure loopback interfaces. doas -n /sbin/ifconfig lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo17 inet 127.0.0.17 alias doas -n /sbin/route -n -T 17 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 17 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 lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1/8 doas -n /sbin/ifconfig lo18 inet 127.0.0.18 alias doas -n /sbin/route -n -T 18 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 18 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 17 add -inet -host 127.0.0.18 127.0.0.1 add host 127.0.0.18: gateway 127.0.0.1 doas -n /sbin/route -n -T 18 add -inet -host 127.0.0.17 127.0.0.1 add host 127.0.0.17: gateway 127.0.0.1 # Wait until IPv6 addresses are no longer tentative. for i in `jot 50`; do if ! { /sbin/ifconfig lo17; /sbin/ifconfig lo18; } | fgrep -q tentative; then break; fi; sleep .1; done ! { /sbin/ifconfig lo17; /sbin/ifconfig lo18; } | fgrep tentative ==== pfctl ==== # Create python include file containing the addresses. rm -f addr.py addr.py.tmp echo 'N1="17"' >>addr.py.tmp echo 'IF_N1="lo17"' >>addr.py.tmp echo 'ADDR_N1="127.0.0.17"' >>addr.py.tmp echo 'N2="18"' >>addr.py.tmp echo 'IF_N2="lo18"' >>addr.py.tmp echo 'ADDR_N2="127.0.0.18"' >>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-17 ==== rm -f lo17.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo17' || true doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo17 >lo17.tcpdump & rm -f stamp-stop rm -f lo18.tcpdump doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo18' || true tcpdump: listening on lo17, link-type LOOP doas -n /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo18 >lo18.tcpdump & rm -f stamp-stop sleep 2 # XXX tcpdump: listening on lo18, link-type LOOP # Ping localhost in routing domain 17. /sbin/ping -n -w 1 -c 1 -V 17 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-17 ==== # Ping non existing address with loopback route in routing domain 17. ! /sbin/ping -n -w 1 -c 1 -V 17 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-17 ==== # Ping local address in routing domain 17. /sbin/ping -n -w 1 -c 1 -V 17 127.0.0.17 PING 127.0.0.17 (127.0.0.17): 56 data bytes 64 bytes from 127.0.0.17: icmp_seq=0 ttl=255 time=0.088 ms --- 127.0.0.17 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.088/0.088/0.088/0.000 ms ==== run-ping-local-18 ==== # Ping localhost in routing domain 18. /sbin/ping -n -w 1 -c 1 -V 18 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.095 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.095/0.095/0.095/0.000 ms ==== run-ping-loop-18 ==== # Ping non existing address with loopback route in routing domain 18. ! /sbin/ping -n -w 1 -c 1 -V 18 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-18 ==== # Ping local address in routing domain 18. /sbin/ping -n -w 1 -c 1 -V 18 127.0.0.18 PING 127.0.0.18 (127.0.0.18): 56 data bytes 64 bytes from 127.0.0.18: icmp_seq=0 ttl=255 time=0.085 ms --- 127.0.0.18 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-rdomain-pass ==== # Pass ping packets between routing domains with pf rule. /sbin/ping -n -w 1 -c 1 -V 17 127.0.0.18 PING 127.0.0.18 (127.0.0.18): 56 data bytes 64 bytes from 127.0.0.18: icmp_seq=0 ttl=255 time=0.090 ms --- 127.0.0.18 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-block ==== # Check that reverse direction without pf rule is not allowed. ! /sbin/ping -n -w 1 -c 1 -V 18 127.0.0.17 PING 127.0.0.17 (127.0.0.17): 56 data bytes --- 127.0.0.17 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 17 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-17 ==== sleep 2 # XXX doas -n pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni' 488 packets received by filter 0 packets dropped by kernel 489 packets received by filter 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' lo17.tcpdump 04:57:00.464000 127.0.0.1 > 127.0.0.1: icmp: echo request (id:ce7e seq:0) [icmp cksum ok] (ttl 255, id 10483, len 84, bad ip cksum 0! -> 94b3) ==== run-bpf-loop-17 ==== # 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,' lo17.tcpdump 04:57:00.548743 127.0.0.1 > 10.6.6.6: icmp: echo request (id:4ab4 seq:0) [icmp cksum ok] (ttl 255, id 31764, len 84, bad ip cksum 0! -> b087) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 04:57:00.550429 127.0.0.1 > 10.6.6.6: icmp: echo request (id:4ab4 seq:0) [icmp cksum ok] [ttl 1] (id 31764, len 84, bad ip cksum 0! -> ae88) ==== run-bpf-local-18 ==== # Check that the ping packet went through loopback. grep '127.0.0.1 > 127.0.0.1: icmp: echo request' lo18.tcpdump 04:57:02.725970 127.0.0.1 > 127.0.0.1: icmp: echo request (id:f346 seq:0) [icmp cksum ok] (ttl 255, id 33053, len 84, bad ip cksum 0! -> 3c89) ==== run-bpf-loop-18 ==== # 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,' lo18.tcpdump 04:57:02.812041 127.0.0.1 > 10.6.6.6: icmp: echo request (id:ea0b seq:0) [icmp cksum ok] (ttl 255, id 7932, len 84, bad ip cksum 0! -> da0) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo18.tcpdump 04:57:02.813791 127.0.0.1 > 10.6.6.6: icmp: echo request (id:ea0b seq:0) [icmp cksum ok] [ttl 1] (id 7932, len 84, bad ip cksum 0! -> ba1) ==== run-bpf-rdomain-loop-17 ==== # 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,' lo17.tcpdump 04:57:07.177177 127.0.0.1 > 10.7.7.7: icmp: echo request (id:61ee seq:0) [icmp cksum ok] (ttl 255, id 38642, len 84, bad ip cksum 0! -> 94a7) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 254,' lo17.tcpdump grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 04:57:07.178176 127.0.0.1 > 10.7.7.7: icmp: echo request (id:61ee seq:0) [icmp cksum ok] [ttl 1] (id 38642, len 84, bad ip cksum 0! -> 92a8) ==== run-bpf-rdomain-loop-18 ==== # 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,' lo18.tcpdump 04:57:07.177196 127.0.0.1 > 10.7.7.7: icmp: echo request (id:61ee seq:0) [icmp cksum ok] (ttl 254, id 38642, len 84, bad ip cksum 0! -> 95a7) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo18.tcpdump 04:57:07.178172 127.0.0.1 > 10.7.7.7: icmp: echo request (id:61ee seq:0) [icmp cksum ok] (ttl 2, id 38642, len 84, bad ip cksum 0! -> 91a8) ! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]' lo18.tcpdump ==== unconfig ==== # Destroy interfaces. doas -n /sbin/ifconfig lo17 rdomain 17 doas -n /sbin/ifconfig lo17 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo17 inet 127.0.0.17 delete doas -n /sbin/ifconfig lo17 destroy doas -n /sbin/ifconfig lo18 rdomain 18 doas -n /sbin/ifconfig lo18 inet 127.0.0.1 delete doas -n /sbin/ifconfig lo18 inet 127.0.0.18 delete doas -n /sbin/ifconfig lo18 destroy rm -f stamp-ifconfig