==== 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.094 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.094/0.094/0.094/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.087 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.087/0.087/0.087/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.089 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.089/0.089/0.089/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.091 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.091/0.091/0.091/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.092 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.092/0.092/0.092/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' 489 packets received by filter 0 packets dropped by kernel 488 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:52:11.784015 127.0.0.1 > 127.0.0.1: icmp: echo request (id:bb2a seq:0) [icmp cksum ok] (ttl 255, id 16284, len 84, bad ip cksum 0! -> 7e0a) ==== 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:52:11.868934 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e2be seq:0) [icmp cksum ok] (ttl 255, id 57063, len 84, bad ip cksum 0! -> 4db4) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo17.tcpdump 04:52:11.870744 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e2be seq:0) [icmp cksum ok] [ttl 1] (id 57063, len 84, bad ip cksum 0! -> 4bb5) ==== 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:52:14.044426 127.0.0.1 > 127.0.0.1: icmp: echo request (id:aa93 seq:0) [icmp cksum ok] (ttl 255, id 64830, len 84, bad ip cksum 0! -> c067) ==== 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:52:14.127794 127.0.0.1 > 10.6.6.6: icmp: echo request (id:af19 seq:0) [icmp cksum ok] (ttl 255, id 43891, len 84, bad ip cksum 0! -> 8128) grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]' lo18.tcpdump 04:52:14.129616 127.0.0.1 > 10.6.6.6: icmp: echo request (id:af19 seq:0) [icmp cksum ok] [ttl 1] (id 43891, len 84, bad ip cksum 0! -> 7f29) ==== 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:52:18.488717 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3606 seq:0) [icmp cksum ok] (ttl 255, id 19730, len 84, bad ip cksum 0! -> de87) ! 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:52:18.489788 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3606 seq:0) [icmp cksum ok] [ttl 1] (id 19730, len 84, bad ip cksum 0! -> dc88) ==== 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:52:18.488734 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3606 seq:0) [icmp cksum ok] (ttl 254, id 19730, len 84, bad ip cksum 0! -> df87) grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,' lo18.tcpdump 04:52:18.489783 127.0.0.1 > 10.7.7.7: icmp: echo request (id:3606 seq:0) [icmp cksum ok] (ttl 2, id 19730, len 84, bad ip cksum 0! -> db88) ! 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