==== 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.093 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.093/0.093/0.093/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.085 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.085/0.085/0.085/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.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-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.089 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.089/0.089/0.089/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.089 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.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 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 11:15:26.074850 127.0.0.1 > 127.0.0.1: icmp: echo request (id:ffe0 seq:0) [icmp cksum ok] (ttl 255, id 54682, len 84, bad ip cksum 0! -> e80b) ==== 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 11:15:26.158436 127.0.0.1 > 10.6.6.6: icmp: echo request (id:d7c1 seq:0) [icmp cksum ok] (ttl 255, id 56973, len 84, bad ip cksum 0! -> 4e0e) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 11:15:26.160131 127.0.0.1 > 10.6.6.6: icmp: echo request (id:d7c1 seq:0) [icmp cksum ok] [ttl 1] (id 56973, len 84, bad ip cksum 0! -> 4c0f) ==== 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 11:15:28.334573 127.0.0.1 > 127.0.0.1: icmp: echo request (id:ec65 seq:0) [icmp cksum ok] (ttl 255, id 1224, len 84, bad ip cksum 0! -> b8de) ==== 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 11:15:28.417340 127.0.0.1 > 10.6.6.6: icmp: echo request (id:5056 seq:0) [icmp cksum ok] (ttl 255, id 48457, len 84, bad ip cksum 0! -> 6f52) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo18.tcpdump 11:15:28.419053 127.0.0.1 > 10.6.6.6: icmp: echo request (id:5056 seq:0) [icmp cksum ok] [ttl 1] (id 48457, len 84, bad ip cksum 0! -> 6d53) ==== 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 11:15:32.777948 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3d63 seq:0) [icmp cksum ok] (ttl 255, id 35231, len 84, bad ip cksum 0! -> a1fa) ! 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 11:15:32.778954 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3d63 seq:0) [icmp cksum ok] [ttl 1] (id 35231, len 84, bad ip cksum 0! -> 9ffb) ==== 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 11:15:32.777965 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3d63 seq:0) [icmp cksum ok] (ttl 254, id 35231, len 84, bad ip cksum 0! -> a2fa) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo18.tcpdump 11:15:32.778951 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3d63 seq:0) [icmp cksum ok] (ttl 2, id 35231, len 84, bad ip cksum 0! -> 9efb) ! 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