Ran this script: https://people.freebsd.org/~rstone/scripts/subnet-route-test
On stock FreeBSD, the final "ifconfig" command fails with "ifconfig: ioctl (SIOCAIFADDR): File exists" and if you run "arp -na" afterwards you see a stray 2.0.0.1 that cannot be removed.
With this fix, the IP address can be assigned as expected.
I also tested changing a 2.0.0.0/8 route and verified that the IFA_ROUTE flag was not migrated because the subnet width was different.
%%%
New ATF test for IPv4 and IPv6 cases:
With r330147:
# kyua test fibs_test:ipv4_move_subnet_route fibs_test:ipv6_move_subnet_route
fibs_test:ipv4_move_subnet_route -> failed: atf-check failed; see the output of the test for details [0.121s]
fibs_test:ipv6_move_subnet_route -> passed [0.107s]
Results file id is usr_tests_sys_netinet.20180301-204924-411726
Results saved to /root/.kyua/store/results.usr_tests_sys_netinet.20180301-204924-411726.db
1/2 passed (1 failed)
# kyua report --verbose fibs_test:ipv4_move_subnet_route
===> Execution context
Current directory: /usr/tests/sys/netinet
Environment variables:
BLOCKSIZE=K
HOME=/root
LOGNAME=root
MAIL=/var/mail/root
OLDPWD=/root
PAGER=more
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
PWD=/usr/tests/sys/netinet
SHELL=/bin/sh
TERM=vt102
USER=root
===> fibs_test:ipv4_move_subnet_route
Result: failed: atf-check failed; see the output of the test for details
Start time: 2018-03-01T20:49:25.098671Z
End time: 2018-03-01T20:49:25.219287Z
Duration: 0.121s
Metadata:
allowed_architectures is empty
allowed_platforms is empty
description = moving a subnet route to different ifa should be possible
has_cleanup = true
is_exclusive = false
required_configs = fibs
required_disk_space = 0
required_files is empty
required_memory = 0
required_programs is empty
required_user = root
timeout = 300
Standard output:
fib is 1
/sbin/pfctl
/sbin/ipf
ipf: IP Filter: v5.1.2 (608)
setfib 1 ifconfig epair0a inet 192.0.2.1/24 fib 1
setfib 1 ifconfig epair0b inet 192.0.2.2/24 fib 1
change net 192.0.2.0 fib 1
Executing command [ ifconfig epair0b inet 192.0.2.1/24 alias fib 1 ]
ifconfig epair0a destroy
Standard error:
pfctl: /dev/pf: No such file or directory
sysctl: unknown oid 'net.inet.ip.fw.enable'
[: =: unexpected operator
open device: No such file or directory
Fail: incorrect exit status: 1, expected: 0
stdout:
stderr:
ifconfig: ioctl (SIOCAIFADDR): File exists
Files left in work directory after failure: ifaces_to_cleanup
===> Failed tests
fibs_test:ipv4_move_subnet_route -> failed: atf-check failed; see the output of the test for details [0.121s]
===> Summary
Results read from /root/.kyua/store/results.usr_tests_sys_netinet.20180301-204924-411726.db
Test cases: 1 total, 0 skipped, 0 expected failures, 0 broken, 1 failed
Start time: 2018-03-01T20:49:25.098671Z
End time: 2018-03-01T20:49:25.219287Z
Total time: 0.121s
With fix:
# kyua test fibs_test:ipv4_move_subnet_route fibs_test:ipv6_move_subnet_route
fibs_test:ipv4_move_subnet_route -> passed [0.107s]
fibs_test:ipv6_move_subnet_route -> passed [0.113s]
Results file id is usr_tests_sys_netinet.20180301-204556-470959
Results saved to /root/.kyua/store/results.usr_tests_sys_netinet.20180301-204556-470959.db
2/2 passed (0 failed)