1# 2# SPDX-License-Identifier: BSD-2-Clause 3# 4# Copyright (c) 2020 Kristof Provost <kp@FreeBSD.org> 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26 27. $(atf_get_srcdir)/../common/vnet.subr 28 29is_master() 30{ 31 jail=$1 32 itf=$2 33 34 jexec ${jail} ifconfig ${itf} | grep -E '(carp|vrrp)' | grep MASTER 35} 36 37wait_for_carp() 38{ 39 jail1=$1 40 itf1=$2 41 jail2=$3 42 itf2=$4 43 44 while [ -z "$(is_master ${jail1} ${itf1})" ] && 45 [ -z "$(is_master ${jail2} ${itf2})" ]; do 46 sleep 0.1 47 done 48 49 if [ -n "$(is_master ${jail1} ${itf1})" ] && 50 [ -n "$(is_master ${jail2} ${itf2})" ]; then 51 atf_fail "Both jails are master" 52 fi 53} 54 55carp_init() 56{ 57 if ! kldstat -q -m carp; then 58 atf_skip "This test requires carp" 59 fi 60 61 vnet_init 62} 63 64atf_test_case "basic_v4" "cleanup" 65basic_v4_head() 66{ 67 atf_set descr 'Basic CARP test (IPv4)' 68 atf_set require.user root 69} 70 71basic_v4_body() 72{ 73 carp_init 74 vnet_init_bridge 75 76 bridge=$(vnet_mkbridge) 77 epair_one=$(vnet_mkepair) 78 epair_two=$(vnet_mkepair) 79 80 vnet_mkjail carp_basic_v4_one ${bridge} ${epair_one}a ${epair_two}a 81 vnet_mkjail carp_basic_v4_two ${epair_one}b 82 vnet_mkjail carp_basic_v4_three ${epair_two}b 83 84 jexec carp_basic_v4_one ifconfig ${bridge} 192.0.2.4/29 up 85 jexec carp_basic_v4_one ifconfig ${bridge} addm ${epair_one}a \ 86 addm ${epair_two}a 87 jexec carp_basic_v4_one ifconfig ${epair_one}a up 88 jexec carp_basic_v4_one ifconfig ${epair_two}a up 89 90 jexec carp_basic_v4_two ifconfig ${epair_one}b 192.0.2.202/29 up 91 jexec carp_basic_v4_two ifconfig ${epair_one}b add vhid 1 192.0.2.1/29 92 93 sleep 0.2 94 jexec carp_basic_v4_three ifconfig ${epair_two}b 192.0.2.203/29 up 95 jexec carp_basic_v4_three ifconfig ${epair_two}b add vhid 1 \ 96 192.0.2.1/29 97 98 wait_for_carp carp_basic_v4_two ${epair_one}b \ 99 carp_basic_v4_three ${epair_two}b 100 101 atf_check -s exit:0 -o ignore jexec carp_basic_v4_one \ 102 ping -c 3 192.0.2.1 103} 104 105basic_v4_cleanup() 106{ 107 vnet_cleanup 108} 109 110atf_test_case "vrrp_v4" "cleanup" 111vrrp_v4_head() 112{ 113 atf_set descr 'Basic VRRP test (IPv4)' 114 atf_set require.user root 115} 116 117vrrp_v4_body() 118{ 119 carp_init 120 vnet_init_bridge 121 122 j=vrrp_basic_v4 123 124 bridge=$(vnet_mkbridge) 125 epair_one=$(vnet_mkepair) 126 epair_two=$(vnet_mkepair) 127 128 vnet_mkjail ${j}_one ${bridge} ${epair_one}a ${epair_two}a 129 vnet_mkjail ${j}_two ${epair_one}b 130 vnet_mkjail ${j}_three ${epair_two}b 131 132 jexec ${j}_one ifconfig ${bridge} 192.0.2.4/29 up 133 jexec ${j}_one ifconfig ${bridge} addm ${epair_one}a \ 134 addm ${epair_two}a 135 jexec ${j}_one ifconfig ${epair_one}a up 136 jexec ${j}_one ifconfig ${epair_two}a up 137 138 jexec ${j}_two ifconfig ${epair_one}b 192.0.2.202/29 up 139 jexec ${j}_two ifconfig ${epair_one}b add vhid 1 carpver 3 192.0.2.1/29 140 141 sleep 0.2 142 jexec ${j}_three ifconfig ${epair_two}b 192.0.2.203/29 up 143 jexec ${j}_three ifconfig ${epair_two}b add vhid 1 carpver 3 \ 144 192.0.2.1/29 145 146 wait_for_carp ${j}_two ${epair_one}b \ 147 ${j}_three ${epair_two}b 148 149 atf_check -s exit:0 -o ignore jexec ${j}_one \ 150 ping -c 3 192.0.2.1 151} 152 153vrrp_v4_cleanup() 154{ 155 vnet_cleanup 156} 157 158atf_test_case "unicast_v4" "cleanup" 159unicast_v4_head() 160{ 161 atf_set descr 'Unicast CARP test (IPv4)' 162 atf_set require.user root 163} 164 165unicast_v4_body() 166{ 167 carp_init 168 169 epair_one=$(vnet_mkepair) 170 epair_two=$(vnet_mkepair) 171 172 j="carp_uni_v4_" 173 174 # The router 175 vnet_mkjail ${j}one ${epair_one}a ${epair_two}a 176 # The hosts 177 vnet_mkjail ${j}two ${epair_one}b 178 vnet_mkjail ${j}three ${epair_two}b 179 180 atf_check -o ignore sysctl -j ${j}one net.inet.ip.forwarding=1 181 atf_check ifconfig -j ${j}one ${epair_one}a inet 198.51.100.1/25 182 atf_check ifconfig -j ${j}one ${epair_two}a inet 198.51.100.129/25 183 184 atf_check ifconfig -j ${j}two ${epair_one}b 198.51.100.2/25 up 185 atf_check -o ignore route -j ${j}two -n add default 198.51.100.1 186 187 atf_check ifconfig -j ${j}three ${epair_two}b 198.51.100.224/25 up 188 atf_check -o ignore route -j ${j}three -n add default 198.51.100.129 189 190 sleep 0.1 191 # Sanity check 192 atf_check -o ignore jexec ${j}one \ 193 ping -c 1 198.51.100.2 194 atf_check -o ignore jexec ${j}one \ 195 ping -c 1 198.51.100.224 196 atf_check -o ignore jexec ${j}two \ 197 ping -c 1 198.51.100.224 198 199 # A peer address x.x.x.224 to catch PR 284872 200 atf_check ifconfig -j ${j}two ${epair_one}b add vhid 1 \ 201 peer 198.51.100.224 192.0.2.1/32 202 sleep 0.2 203 atf_check ifconfig -j ${j}three ${epair_two}b add vhid 1 \ 204 peer 198.51.100.2 192.0.2.1/32 205 206 wait_for_carp ${j}two ${epair_one}b \ 207 ${j}three ${epair_two}b 208 209 if is_master ${j}two ${epair_one}b ; then 210 atf_check -o ignore \ 211 route -j ${j}one -n add 192.0.2.1 198.51.100.2 212 fi 213 214 if is_master ${j}three ${epair_two}b ; then 215 atf_check -o ignore \ 216 route -j ${j}one -n add 192.0.2.1 198.51.100.224 217 fi 218 219 # Not necessarily required, but just in case 220 atf_check -o ignore jexec ${j}one \ 221 ping -c 1 192.0.2.1 222 223 # Check that we remain in unicast when tweaking settings 224 atf_check -o ignore \ 225 ifconfig -j ${j}two ${epair_one}b vhid 1 advskew 2 226 atf_check -o match:"peer 198.51.100.224" \ 227 ifconfig -j ${j}two ${epair_one}b 228} 229 230unicast_v4_cleanup() 231{ 232 vnet_cleanup 233} 234 235atf_test_case "basic_v6" "cleanup" 236basic_v6_head() 237{ 238 atf_set descr 'Basic CARP test (IPv6)' 239 atf_set require.user root 240} 241 242basic_v6_body() 243{ 244 carp_init 245 vnet_init_bridge 246 247 bridge=$(vnet_mkbridge) 248 epair_one=$(vnet_mkepair) 249 epair_two=$(vnet_mkepair) 250 251 vnet_mkjail carp_basic_v6_one ${bridge} ${epair_one}a ${epair_two}a 252 vnet_mkjail carp_basic_v6_two ${epair_one}b 253 vnet_mkjail carp_basic_v6_three ${epair_two}b 254 255 jexec carp_basic_v6_one ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ 256 no_dad 257 jexec carp_basic_v6_one ifconfig ${bridge} addm ${epair_one}a \ 258 addm ${epair_two}a 259 jexec carp_basic_v6_one ifconfig ${epair_one}a up 260 jexec carp_basic_v6_one ifconfig ${epair_two}a up 261 262 jexec carp_basic_v6_two ifconfig ${epair_one}b inet6 \ 263 2001:db8::1:2/64 up no_dad 264 jexec carp_basic_v6_two ifconfig ${epair_one}b inet6 add vhid 1 \ 265 2001:db8::0:1/64 266 267 sleep 0.2 268 jexec carp_basic_v6_three ifconfig ${epair_two}b inet6 2001:db8::1:3/64 up no_dad 269 jexec carp_basic_v6_three ifconfig ${epair_two}b inet6 add vhid 1 \ 270 2001:db8::0:1/64 271 272 wait_for_carp carp_basic_v6_two ${epair_one}b \ 273 carp_basic_v6_three ${epair_two}b 274 275 atf_check -s exit:0 -o ignore jexec carp_basic_v6_one \ 276 ping -6 -c 3 2001:db8::0:1 277} 278 279basic_v6_cleanup() 280{ 281 vnet_cleanup 282} 283 284atf_test_case "vrrp_v6" "cleanup" 285vrrp_v6_head() 286{ 287 atf_set descr 'Basic VRRP test (IPv6)' 288 atf_set require.user root 289} 290 291vrrp_v6_body() 292{ 293 carp_init 294 vnet_init_bridge 295 296 j=carp_basic_v6 297 298 bridge=$(vnet_mkbridge) 299 epair_one=$(vnet_mkepair) 300 epair_two=$(vnet_mkepair) 301 302 vnet_mkjail ${j}_one ${bridge} ${epair_one}a ${epair_two}a 303 vnet_mkjail ${j}_two ${epair_one}b 304 vnet_mkjail ${j}_three ${epair_two}b 305 306 jexec ${j}_one ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ 307 no_dad 308 jexec ${j}_one ifconfig ${bridge} addm ${epair_one}a \ 309 addm ${epair_two}a 310 jexec ${j}_one ifconfig ${epair_one}a up 311 jexec ${j}_one ifconfig ${epair_two}a up 312 313 jexec ${j}_two ifconfig ${epair_one}b inet6 \ 314 2001:db8::1:2/64 up no_dad 315 jexec ${j}_two ifconfig ${epair_one}b inet6 add vhid 1 carpver 3 \ 316 2001:db8::0:1/64 317 318 sleep 0.2 319 jexec ${j}_three ifconfig ${epair_two}b inet6 2001:db8::1:3/64 up no_dad 320 jexec ${j}_three ifconfig ${epair_two}b inet6 add vhid 1 carpver 3 \ 321 2001:db8::0:1/64 322 323 wait_for_carp ${j}_two ${epair_one}b \ 324 ${j}_three ${epair_two}b 325 326 atf_check -s exit:0 -o ignore jexec ${j}_one \ 327 ping -6 -c 3 2001:db8::0:1 328} 329 330vrrp_v6_cleanup() 331{ 332 vnet_cleanup 333} 334 335atf_test_case "unicast_v6" "cleanup" 336unicast_v6_head() 337{ 338 atf_set descr 'Unicast CARP test (IPv6)' 339 atf_set require.user root 340} 341 342unicast_v6_body() 343{ 344 carp_init 345 vnet_init_bridge 346 347 bridge=$(vnet_mkbridge) 348 epair_one=$(vnet_mkepair) 349 epair_two=$(vnet_mkepair) 350 351 vnet_mkjail carp_uni_v6_one ${bridge} ${epair_one}a ${epair_two}a 352 vnet_mkjail carp_uni_v6_two ${epair_one}b 353 vnet_mkjail carp_uni_v6_three ${epair_two}b 354 355 jexec carp_uni_v6_one sysctl net.inet6.ip6.forwarding=1 356 jexec carp_uni_v6_one ifconfig ${bridge} addm ${epair_one}a \ 357 addm ${epair_two}a 358 jexec carp_uni_v6_one ifconfig ${epair_one}a up 359 jexec carp_uni_v6_one ifconfig ${epair_two}a up 360 jexec carp_uni_v6_one ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ 361 no_dad 362 jexec carp_uni_v6_one ifconfig ${bridge} inet6 alias 2001:db8:1::1/64 \ 363 no_dad up 364 jexec carp_uni_v6_one ifconfig ${bridge} inet6 alias 2001:db8:2::1/64 \ 365 no_dad up 366 367 jexec carp_uni_v6_two ifconfig ${epair_one}b inet6 2001:db8:1::2/64 \ 368 no_dad up 369 jexec carp_uni_v6_two route -6 add default 2001:db8:1::1 370 jexec carp_uni_v6_two ifconfig ${epair_one}b inet6 add vhid 1 \ 371 peer6 2001:db8:2::2 \ 372 2001:db8::0:1/64 373 374 sleep 0.2 375 jexec carp_uni_v6_three ifconfig ${epair_two}b inet6 2001:db8:2::2/64 \ 376 no_dad up 377 jexec carp_uni_v6_three route -6 add default 2001:db8:2::1 378 jexec carp_uni_v6_three ifconfig ${epair_two}b inet6 add vhid 1 \ 379 peer6 2001:db8:1::2 \ 380 2001:db8::0:1/64 381 382 # Sanity check 383 atf_check -s exit:0 -o ignore jexec carp_uni_v6_two \ 384 ping -6 -c 1 2001:db8:2::2 385 386 wait_for_carp carp_uni_v6_two ${epair_one}b \ 387 carp_uni_v6_three ${epair_two}b 388 389 atf_check -s exit:0 -o ignore jexec carp_uni_v6_one \ 390 ping -6 -c 3 2001:db8::0:1 391} 392 393unicast_v6_cleanup() 394{ 395 vnet_cleanup 396} 397 398atf_test_case "unicast_ll_v6" "cleanup" 399unicast_ll_v6_head() 400{ 401 atf_set descr 'Unicast CARP test (IPv6, link-local)' 402 atf_set require.user root 403} 404 405unicast_ll_v6_body() 406{ 407 carp_init 408 vnet_init_bridge 409 410 j=carp_uni_ll_v6 411 412 bridge=$(vnet_mkbridge) 413 epair_one=$(vnet_mkepair) 414 epair_two=$(vnet_mkepair) 415 416 vnet_mkjail ${j}_one ${bridge} ${epair_one}a ${epair_two}a 417 vnet_mkjail ${j}_two ${epair_one}b 418 vnet_mkjail ${j}_three ${epair_two}b 419 420 jexec ${j}_one ifconfig ${bridge} addm ${epair_one}a \ 421 addm ${epair_two}a 422 jexec ${j}_one ifconfig ${epair_one}a up 423 jexec ${j}_one ifconfig ${epair_two}a up 424 jexec ${j}_one ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ 425 no_dad 426 jexec ${j}_one ifconfig ${bridge} inet6 alias 2001:db8:1::1/64 \ 427 no_dad up 428 429 jexec ${j}_two ifconfig ${epair_one}b inet6 2001:db8:1::2/64 \ 430 no_dad up 431 jexec ${j}_three ifconfig ${epair_two}b inet6 2001:db8:1::3/64 \ 432 no_dad up 433 434 ll_one=$(jexec ${j}_two ifconfig ${epair_one}b | awk "/ .*%${epair_one}b.* / { print \$2 }" | cut -d % -f 1) 435 ll_two=$(jexec ${j}_three ifconfig ${epair_two}b | awk "/ .*%${epair_two}b.* / { print \$2 }" | cut -d % -f 1) 436 437 jexec ${j}_two ifconfig ${epair_one}b inet6 add vhid 1 \ 438 peer6 ${ll_two} \ 439 2001:db8::0:1/64 440 sleep 0.2 441 jexec ${j}_three ifconfig ${epair_two}b inet6 add vhid 1 \ 442 peer6 ${ll_one} \ 443 2001:db8::0:1/64 444 445 # Sanity check 446 atf_check -s exit:0 -o ignore jexec ${j}_two \ 447 ping -6 -c 1 2001:db8:1::3 448 449 wait_for_carp ${j}_two ${epair_one}b \ 450 ${j}_three ${epair_two}b 451 452 atf_check -s exit:0 -o ignore jexec ${j}_one \ 453 ping -6 -c 3 2001:db8::0:1 454} 455 456unicast_ll_v6_cleanup() 457{ 458 vnet_cleanup 459} 460 461atf_test_case "negative_demotion" "cleanup" 462negative_demotion_head() 463{ 464 atf_set descr 'Test PR #259528' 465 atf_set require.user root 466} 467 468negative_demotion_body() 469{ 470 carp_init 471 472 epair=$(vnet_mkepair) 473 474 vnet_mkjail one ${epair}a 475 jexec one sysctl net.inet.carp.preempt=1 476 jexec one ifconfig ${epair}a 192.0.2.1/24 up 477 jexec one ifconfig ${epair}a add vhid 1 192.0.2.254/24 \ 478 advskew 0 pass foobar 479 480 vnet_mkjail two ${epair}b 481 jexec two sysctl net.inet.carp.preempt=1 482 jexec two ifconfig ${epair}b 192.0.2.2/24 up 483 jexec two ifconfig ${epair}b add vhid 1 192.0.2.254/24 \ 484 advskew 100 pass foobar 485 486 # Allow things to settle 487 wait_for_carp one ${epair}a two ${epair}b 488 489 if is_master one ${epair}a && is_master two ${epair}b 490 then 491 atf_fail "Two masters!" 492 fi 493 494 jexec one sysctl net.inet.carp.demotion=-1 495 sleep 3 496 497 if is_master one ${epair}a && is_master two ${epair}b 498 then 499 atf_fail "Two masters!" 500 fi 501} 502 503negative_demotion_cleanup() 504{ 505 vnet_cleanup 506} 507 508atf_test_case "vrrp_preempt" "cleanup" 509vrrp_preempt_head() 510{ 511 atf_set descr 'Test VRRP preemption' 512 atf_set require.user root 513} 514 515vrrp_preempt_body() 516{ 517 carp_init 518 519 epair1=$(vnet_mkepair) 520 epair2=$(vnet_mkepair) 521 522 vnet_mkjail one ${epair1}a ${epair2}a 523 jexec one sysctl net.inet.carp.preempt=1 524 jexec one ifconfig ${epair1}a 192.0.2.1/24 up 525 jexec one ifconfig ${epair1}a add vhid 1 carpver 3 192.0.2.254/24 \ 526 vrrpprio 10 pass foobar1 527 jexec one ifconfig ${epair2}a 192.0.3.1/24 up 528 jexec one ifconfig ${epair2}a add vhid 2 carpver 3 192.0.3.254/24 \ 529 vrrpprio 10 pass foobar2 530 531 vnet_mkjail two ${epair1}b ${epair2}b 532 jexec two sysctl net.inet.carp.preempt=1 533 jexec two ifconfig ${epair1}b 192.0.2.2/24 up 534 jexec two ifconfig ${epair2}b 192.0.3.2/24 up 535 jexec two ifconfig ${epair1}b add vhid 1 carpver 3 192.0.2.254/24 \ 536 vrrpprio 1 pass foobar1 537 jexec two ifconfig ${epair2}b add vhid 2 carpver 3 192.0.3.254/24 \ 538 vrrpprio 1 pass foobar2 539 540 # Allow things to settle 541 wait_for_carp one ${epair1}a two ${epair1}b 542 wait_for_carp one ${epair2}a two ${epair2}b 543 544 # Bring down one interface; preemption should demote the second interface too 545 jexec one ifconfig ${epair1}a down 546 sleep 3 547 548 if is_master one ${epair2}a 549 then 550 atf_fail "preemption did not affect the second interface" 551 fi 552 553 # Bring interface back up; one should reclaim master 554 jexec one ifconfig ${epair1}a up 555 sleep 3 556 557 if ! is_master one ${epair2}a 558 then 559 atf_fail "Priority router did not take its master role back" 560 fi 561} 562 563vrrp_preempt_cleanup() 564{ 565 vnet_cleanup 566} 567 568 569 570atf_test_case "nd6_ns_source_mac" "cleanup" 571nd6_ns_source_mac_head() 572{ 573 atf_set descr 'CARP ndp neighbor solicitation MAC source test (IPv6)' 574 atf_set require.user root 575} 576 577nd6_ns_source_mac_body() 578{ 579 carp_init 580 vnet_init_bridge 581 582 bridge=$(vnet_mkbridge) 583 epair_one=$(vnet_mkepair) 584 epair_two=$(vnet_mkepair) 585 586 vnet_mkjail carp_ndp_v6_bridge ${bridge} ${epair_one}a ${epair_two}a 587 vnet_mkjail carp_ndp_v6_master ${epair_one}b 588 vnet_mkjail carp_ndp_v6_slave ${epair_two}b 589 590 jexec carp_ndp_v6_bridge ifconfig ${bridge} inet6 2001:db8::0:4/64 up \ 591 no_dad 592 jexec carp_ndp_v6_bridge ifconfig ${bridge} addm ${epair_one}a \ 593 addm ${epair_two}a 594 jexec carp_ndp_v6_bridge ifconfig ${epair_one}a up 595 jexec carp_ndp_v6_bridge ifconfig ${epair_two}a up 596 597 jexec carp_ndp_v6_master ifconfig ${epair_one}b inet6 \ 598 2001:db8::1:2/64 up no_dad 599 jexec carp_ndp_v6_master ifconfig ${epair_one}b inet6 add vhid 1 \ 600 advskew 0 2001:db8::0:1/64 601 602 jexec carp_ndp_v6_slave ifconfig ${epair_two}b inet6 \ 603 2001:db8::1:3/64 up no_dad 604 jexec carp_ndp_v6_slave ifconfig ${epair_two}b inet6 add vhid 1 \ 605 advskew 100 2001:db8::0:1/64 606 607 wait_for_carp carp_ndp_v6_master ${epair_one}b \ 608 carp_ndp_v6_slave ${epair_two}b 609 610 # carp_ndp_v6_master is MASTER 611 612 # trigger a NS from the virtual IP from the BACKUP 613 atf_check -s exit:2 -o ignore jexec carp_ndp_v6_slave \ 614 ping -6 -c 3 -S 2001:db8::0:1 2001:db8::0:4 615 616 # trigger a NS from the virtual IP from the MASTER, 617 # this ping should work 618 atf_check -s exit:0 -o ignore jexec carp_ndp_v6_master \ 619 ping -6 -c 3 -S 2001:db8::0:1 2001:db8::0:4 620 621 # ndp entry should be for the virtual mac 622 atf_check -o match:'2001:db8::1 +00:00:5e:00:01:01' \ 623 jexec carp_ndp_v6_bridge ndp -an 624} 625 626nd6_ns_source_mac_cleanup() 627{ 628 vnet_cleanup 629} 630 631 632atf_test_case "switch" "cleanup" 633switch_head() 634{ 635 atf_set descr 'Switch between master and backup' 636 atf_set require.user root 637} 638 639switch_body() 640{ 641 carp_init 642 643 epair=$(vnet_mkepair) 644 645 ifconfig ${epair}a up 646 ifconfig ${epair}a vhid 1 advskew 100 192.0.2.1/24 647 ifconfig ${epair}a vhid 1 state backup 648 ifconfig ${epair}a vhid 1 state master 649} 650 651switch_cleanup() 652{ 653 vnet_cleanup 654} 655 656atf_init_test_cases() 657{ 658 atf_add_test_case "basic_v4" 659 atf_add_test_case "vrrp_v4" 660 atf_add_test_case "unicast_v4" 661 atf_add_test_case "basic_v6" 662 atf_add_test_case "vrrp_v6" 663 atf_add_test_case "unicast_v6" 664 atf_add_test_case "unicast_ll_v6" 665 atf_add_test_case "negative_demotion" 666 atf_add_test_case "nd6_ns_source_mac" 667 atf_add_test_case "vrrp_preempt" 668 atf_add_test_case "switch" 669} 670