git: b8771c2c9a5f - stable/14 - netinet6 tests: add a test for SIOCAIFADDRing an invalid IPv6 address
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 03:40:21 UTC
The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=b8771c2c9a5f6fda7ea3d101d6378e10f9c5fcc0 commit b8771c2c9a5f6fda7ea3d101d6378e10f9c5fcc0 Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2025-04-07 16:47:23 +0000 Commit: Lexi Winter <ivy@FreeBSD.org> CommitDate: 2025-05-21 02:55:42 +0000 netinet6 tests: add a test for SIOCAIFADDRing an invalid IPv6 address Reviewed by: kp (cherry picked from commit 50725e585de77c20f7c96b836dd68ba954756ce7) --- tests/sys/netinet6/Makefile | 5 ++++- tests/sys/netinet6/addr6.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/sys/netinet6/Makefile b/tests/sys/netinet6/Makefile index 6af0d13c5f03..d06e8069a7fd 100644 --- a/tests/sys/netinet6/Makefile +++ b/tests/sys/netinet6/Makefile @@ -15,7 +15,8 @@ ATF_TESTS_SH= exthdr \ lpm6 \ fibs6 \ ndp \ - proxy_ndp + proxy_ndp \ + addr6 TEST_METADATA.divert+= execenv="jail" \ execenv_jail_params="vnet allow.raw_sockets" @@ -34,6 +35,8 @@ TEST_METADATA.redirect+= execenv="jail" \ execenv_jail_params="vnet allow.raw_sockets" TEST_METADATA.scapyi386+= execenv="jail" \ execenv_jail_params="vnet allow.raw_sockets" +TEST_METADATA.addr6+= execenv="jail" \ + execenv_jail_params="vnet allow.raw_sockets" ${PACKAGE}FILES+= exthdr.py \ mld.py \ diff --git a/tests/sys/netinet6/addr6.sh b/tests/sys/netinet6/addr6.sh new file mode 100755 index 000000000000..38e4bb152240 --- /dev/null +++ b/tests/sys/netinet6/addr6.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env atf-sh +#- +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2025 Lexi Winter. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "addr6_invalid_addr" "cleanup" +addr6_invalid_addr_head() +{ + atf_set descr "adding an invalid IPv6 address returns an error" + atf_set require.user root +} + +addr6_invalid_addr_body() +{ + vnet_init + + ep=$(vnet_mkepair) + atf_check -s exit:0 ifconfig ${ep}a inet6 2001:db8::1/128 + atf_check -s exit:1 -e ignore ifconfig ${ep}a inet6 2001:db8::1/127 alias +} + +addr6_invalid_addr_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "addr6_invalid_addr" +}