git: 50725e585de7 - main - netinet6 tests: add a test for SIOCAIFADDRing an invalid IPv6 address
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Apr 2025 09:05:42 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=50725e585de77c20f7c96b836dd68ba954756ce7 commit 50725e585de77c20f7c96b836dd68ba954756ce7 Author: Lexi Winter <lexi@hemlock.eden.le-fay.org> AuthorDate: 2025-04-07 16:47:23 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-04-08 09:04:42 +0000 netinet6 tests: add a test for SIOCAIFADDRing an invalid IPv6 address Reviewed by: kp --- 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 753571fbf7a1..26f1a18a8d32 100644 --- a/tests/sys/netinet6/Makefile +++ b/tests/sys/netinet6/Makefile @@ -14,7 +14,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" @@ -33,6 +34,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" +}