START	sys/net/loop	2025-03-30T04:44:38Z

==== busy-rdomains ====
# Check if rdomains are busy.

==== ifconfig ====
sleep 2  # XXX
pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni'
*** Error 1 in target 'stamp-stop' (ignored)
rm -f stamp-bpf*
# Destroy interfaces.
/sbin/ifconfig lo11 rdomain 11
/sbin/ifconfig lo11 inet 127.0.0.1 delete
ifconfig: SIOCDIFADDR: Can't assign requested address
*** Error 1 in target 'unconfig' (ignored)
/sbin/ifconfig lo11 inet 127.0.0.11 delete
ifconfig: SIOCDIFADDR: Can't assign requested address
*** Error 1 in target 'unconfig' (ignored)
/sbin/ifconfig lo11 destroy
/sbin/ifconfig lo12 rdomain 12
/sbin/ifconfig lo12 inet 127.0.0.1 delete
ifconfig: SIOCDIFADDR: Can't assign requested address
*** Error 1 in target 'unconfig' (ignored)
/sbin/ifconfig lo12 inet 127.0.0.12 delete
ifconfig: SIOCDIFADDR: Can't assign requested address
*** Error 1 in target 'unconfig' (ignored)
/sbin/ifconfig lo12 destroy
rm -f stamp-ifconfig
# Create and configure loopback interfaces.
/sbin/ifconfig lo11 rdomain 11
/sbin/ifconfig lo11 inet 127.0.0.1/8
/sbin/ifconfig lo11 inet 127.0.0.11 alias
/sbin/route -n -T 11 add -inet -host 10.6.6.6 127.0.0.1
add host 10.6.6.6: gateway 127.0.0.1
/sbin/route -n -T 11 add -inet -host 10.7.7.7 127.0.0.1
add host 10.7.7.7: gateway 127.0.0.1
/sbin/ifconfig lo12 rdomain 12
/sbin/ifconfig lo12 inet 127.0.0.1/8
/sbin/ifconfig lo12 inet 127.0.0.12 alias
/sbin/route -n -T 12 add -inet -host 10.6.6.6 127.0.0.1
add host 10.6.6.6: gateway 127.0.0.1
/sbin/route -n -T 12 add -inet -host 10.7.7.7 127.0.0.1
add host 10.7.7.7: gateway 127.0.0.1
/sbin/route -n -T 11 add -inet -host 127.0.0.12 127.0.0.1
add host 127.0.0.12: gateway 127.0.0.1
/sbin/route -n -T 12 add -inet -host 127.0.0.11 127.0.0.1
add host 127.0.0.11: gateway 127.0.0.1
# Wait until IPv6 addresses are no longer tentative.
for i in `jot 50`; do if ! { /sbin/ifconfig lo11; /sbin/ifconfig lo12; } | fgrep -q tentative; then break; fi; sleep .1; done
! { /sbin/ifconfig lo11; /sbin/ifconfig lo12; } | fgrep tentative

==== pfctl ====
# Create python include file containing the addresses.
rm -f addr.py addr.py.tmp
echo 'N1="11"' >>addr.py.tmp
echo 'IF_N1="lo11"' >>addr.py.tmp
echo 'ADDR_N1="127.0.0.11"' >>addr.py.tmp
echo 'N2="12"' >>addr.py.tmp
echo 'IF_N2="lo12"' >>addr.py.tmp
echo 'ADDR_N2="127.0.0.12"' >>addr.py.tmp
mv addr.py.tmp addr.py
# Load the pf rules into the kernel.
cat addr.py /usr/src/regress/sys/net/loop/pf.conf | /sbin/pfctl -n -f -
cat addr.py /usr/src/regress/sys/net/loop/pf.conf |  /sbin/pfctl -a regress -f -

==== run-ping-local-11 ====
rm -f lo11.tcpdump
pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo11' || true
/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo11 >lo11.tcpdump &
rm -f stamp-stop
rm -f lo12.tcpdump
pkill -f '^/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo12' || true
/usr/sbin/tcpdump -l -e -vvv -s 2048 -ni lo12 >lo12.tcpdump &
rm -f stamp-stop
sleep 2  # XXX
tcpdump: listening on lo12, link-type LOOP
tcpdump: listening on lo11, link-type LOOP
# Ping localhost in routing domain 11.
/sbin/ping -n -w 1 -c 1 -V 11 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.065 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.065/0.065/0.065/0.000 ms

==== run-ping-loop-11 ====
# Ping non existing address with loopback route in routing domain 11.
! /sbin/ping -n -w 1 -c 1 -V 11 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-11 ====
# Ping local address in routing domain 11.
/sbin/ping -n -w 1 -c 1 -V 11 127.0.0.11
PING 127.0.0.11 (127.0.0.11): 56 data bytes
64 bytes from 127.0.0.11: icmp_seq=0 ttl=255 time=0.043 ms

--- 127.0.0.11 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.043/0.043/0.043/0.000 ms

==== run-ping-local-12 ====
# Ping localhost in routing domain 12.
/sbin/ping -n -w 1 -c 1 -V 12 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.039 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.039/0.039/0.039/0.000 ms

==== run-ping-loop-12 ====
# Ping non existing address with loopback route in routing domain 12.
! /sbin/ping -n -w 1 -c 1 -V 12 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-12 ====
# Ping local address in routing domain 12.
/sbin/ping -n -w 1 -c 1 -V 12 127.0.0.12
PING 127.0.0.12 (127.0.0.12): 56 data bytes
64 bytes from 127.0.0.12: icmp_seq=0 ttl=255 time=0.054 ms

--- 127.0.0.12 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.054/0.054/0.054/0.000 ms

==== run-ping-rdomain-pass ====
# Pass ping packets between routing domains with pf rule.
/sbin/ping -n -w 1 -c 1 -V 11 127.0.0.12
PING 127.0.0.12 (127.0.0.12): 56 data bytes
64 bytes from 127.0.0.12: icmp_seq=0 ttl=255 time=0.040 ms

--- 127.0.0.12 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.040/0.040/0.040/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 12 127.0.0.11
PING 127.0.0.11 (127.0.0.11): 56 data bytes

--- 127.0.0.11 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 11 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-11 ====
sleep 2  # XXX
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' lo11.tcpdump
06:44:42.925216 127.0.0.1 > 127.0.0.1: icmp: echo request (id:10ec seq:0) [icmp cksum ok] (ttl 255, id 24863, len 84, bad ip cksum 0! -> 5c87)

==== run-bpf-loop-11 ====
# 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,'  lo11.tcpdump
06:44:42.985034 127.0.0.1 > 10.6.6.6: icmp: echo request (id:84e3 seq:0) [icmp cksum ok] (ttl 255, id 52184, len 84, bad ip cksum 0! -> 60c3)
grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]'  lo11.tcpdump
06:44:42.986369 127.0.0.1 > 10.6.6.6: icmp: echo request (id:84e3 seq:0) [icmp cksum ok] [ttl 1] (id 52184, len 84, bad ip cksum 0! -> 5ec4)

==== run-bpf-local-12 ====
# Check that the ping packet went through loopback.
grep '127.0.0.1 > 127.0.0.1: icmp: echo request' lo12.tcpdump
06:44:45.109091 127.0.0.1 > 127.0.0.1: icmp: echo request (id:dfb7 seq:0) [icmp cksum ok] (ttl 255, id 63413, len 84, bad ip cksum 0! -> c5f0)

==== run-bpf-loop-12 ====
# 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,'  lo12.tcpdump
06:44:45.164611 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e94e seq:0) [icmp cksum ok] (ttl 255, id 53567, len 84, bad ip cksum 0! -> 5b5c)
grep '[0-9] 127.0.0.1 > 10.6.6.6: icmp: echo request .* \[ttl 1\]'  lo12.tcpdump
06:44:45.165784 127.0.0.1 > 10.6.6.6: icmp: echo request (id:e94e seq:0) [icmp cksum ok] [ttl 1] (id 53567, len 84, bad ip cksum 0! -> 595d)

==== run-bpf-rdomain-loop-11 ====
# 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,'  lo11.tcpdump
06:44:49.416219 127.0.0.1 > 10.7.7.7: icmp: echo request (id:a8f6 seq:0) [icmp cksum ok] (ttl 255, id 61702, len 84, bad ip cksum 0! -> 3a93)
! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 254,'  lo11.tcpdump
grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]'  lo11.tcpdump
06:44:49.416848 127.0.0.1 > 10.7.7.7: icmp: echo request (id:a8f6 seq:0) [icmp cksum ok] [ttl 1] (id 61702, len 84, bad ip cksum 0! -> 3894)

==== run-bpf-rdomain-loop-12 ====
# 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,'  lo12.tcpdump
06:44:49.416227 127.0.0.1 > 10.7.7.7: icmp: echo request (id:a8f6 seq:0) [icmp cksum ok] (ttl 254, id 61702, len 84, bad ip cksum 0! -> 3b93)
grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .*ttl 2,'  lo12.tcpdump
06:44:49.416846 127.0.0.1 > 10.7.7.7: icmp: echo request (id:a8f6 seq:0) [icmp cksum ok] (ttl 2, id 61702, len 84, bad ip cksum 0! -> 3794)
! grep '[0-9] 127.0.0.1 > 10.7.7.7: icmp: echo request .* \[ttl 1\]'  lo12.tcpdump

==== unconfig ====
# Destroy interfaces.
/sbin/ifconfig lo11 rdomain 11
/sbin/ifconfig lo11 inet 127.0.0.1 delete
/sbin/ifconfig lo11 inet 127.0.0.11 delete
/sbin/ifconfig lo11 destroy
/sbin/ifconfig lo12 rdomain 12
/sbin/ifconfig lo12 inet 127.0.0.1 delete
/sbin/ifconfig lo12 inet 127.0.0.12 delete
/sbin/ifconfig lo12 destroy
rm -f stamp-ifconfig

PASS	sys/net/loop	Duration 0m16.10s