ifconfig: fix removing IPv6 addresses

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost 2025-07-29 11:50:11 +02:00
parent 98eb6f0eaa
commit da50f49977
2 changed files with 31 additions and 1 deletions

View file

@ -759,7 +759,7 @@ static struct afswtch af_inet6 = {
#else
.af_difaddr = NL_RTM_DELADDR,
.af_aifaddr = NL_RTM_NEWADDR,
.af_ridreq = &in6_add,
.af_ridreq = &in6_del,
.af_addreq = &in6_add,
.af_exec = in6_exec_nl,
#endif

View file

@ -76,8 +76,38 @@ broadcast_cleanup()
vnet_cleanup
}
atf_test_case "delete6" "cleanup"
delete6_head()
{
atf_set descr 'Test removing IPv6 addresses'
atf_set require.user root
}
delete6_body()
{
vnet_init
ep=$(vnet_mkepair)
atf_check -s exit:0 \
ifconfig ${ep}a inet6 fe80::42/64
atf_check -s exit:0 -o match:"fe80::42%${ep}" \
ifconfig ${ep}a inet6
atf_check -s exit:0 \
ifconfig ${ep}a inet6 -alias fe80::42
atf_check -s exit:0 -o not-match:"fe80::42%${ep}" \
ifconfig ${ep}a inet6
}
delete6_cleanup()
{
vnet_cleanup
}
atf_init_test_cases()
{
atf_add_test_case netmask
atf_add_test_case broadcast
atf_add_test_case delete6
}