Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Feb 2025 04:01:57 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d8d8b9c9ca38 - stable/14 - tests: carp: Update test case unicast_v4 to catch PR 284872
Message-ID:  <202502250401.51P41v1n086294@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8d8b9c9ca387217bf70b2db1038529d80af280b

commit d8d8b9c9ca387217bf70b2db1038529d80af280b
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-02-22 19:26:32 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-02-25 04:01:22 +0000

    tests: carp: Update test case unicast_v4 to catch PR 284872
    
    In the current test case unicast_v4, host one acts as a router, but it
    uses if_bridge(4) to verify the reachability to CARP master.
    Unfortunately, if_bridge(4) brings the two CARP hosts into the same
    broadcast domain, thus with an unusual (undocumented) setup, one host
    is in unicast mode but another one in multicast, or two hosts are both
    in multicast mode, the test case can falsely report success.
    
    Fix that by propagating route via routed(8).
    
    PR 284872 shows that CARP(4) happens to send packets with multicast
    destination when the unicast peer address is in the range x.x.x.224 ~
    x.x.x.239. Update the peer address in test case to catch that bug.
    
    PR:             284872
    Reviewed by:    kp
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D49076
    
    (cherry picked from commit 93fbdef51a13b8facac3633f55804a59ca27f635)
---
 tests/sys/netinet/carp.sh | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh
index 8cea2f4cbf1b..e14bedb4f878 100755
--- a/tests/sys/netinet/carp.sh
+++ b/tests/sys/netinet/carp.sh
@@ -116,49 +116,53 @@ unicast_v4_head()
 unicast_v4_body()
 {
 	carp_init
-	vnet_init_bridge
 
-	bridge=$(vnet_mkbridge)
 	epair_one=$(vnet_mkepair)
 	epair_two=$(vnet_mkepair)
 
-	vnet_mkjail carp_uni_v4_one ${bridge} ${epair_one}a ${epair_two}a
+	vnet_mkjail carp_uni_v4_one ${epair_one}a ${epair_two}a
 	vnet_mkjail carp_uni_v4_two ${epair_one}b
 	vnet_mkjail carp_uni_v4_three ${epair_two}b
 
-	jexec carp_uni_v4_one ifconfig ${bridge} 192.0.2.4/29 up
 	jexec carp_uni_v4_one sysctl net.inet.ip.forwarding=1
-	jexec carp_uni_v4_one ifconfig ${bridge} addm ${epair_one}a \
-	    addm ${epair_two}a
-	jexec carp_uni_v4_one ifconfig ${epair_one}a up
-	jexec carp_uni_v4_one ifconfig ${epair_two}a up
-	jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.1/25
-	jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.129/25
+	jexec carp_uni_v4_one ifconfig ${epair_one}a inet 198.51.100.1/25
+	jexec carp_uni_v4_one ifconfig ${epair_two}a inet 198.51.100.129/25
 
+	jexec carp_uni_v4_two sysctl net.inet.ip.forwarding=1
 	jexec carp_uni_v4_two ifconfig ${epair_one}b 198.51.100.2/25 up
-	jexec carp_uni_v4_two route add default 198.51.100.1
+	jexec carp_uni_v4_two route add 198.51.100.224 198.51.100.1
+	# A peer address x.x.x.224 to catch PR 284872
 	jexec carp_uni_v4_two ifconfig ${epair_one}b add vhid 1 \
-	    peer 198.51.100.130 192.0.2.1/29
+	    peer 198.51.100.224 192.0.2.1/32
 
-	jexec carp_uni_v4_three ifconfig ${epair_two}b 198.51.100.130/25 up
-	jexec carp_uni_v4_three route add default 198.51.100.129
+	jexec carp_uni_v4_three sysctl net.inet.ip.forwarding=1
+	jexec carp_uni_v4_three ifconfig ${epair_two}b 198.51.100.224/25 up
+	jexec carp_uni_v4_three route add 198.51.100.2 198.51.100.129
 	jexec carp_uni_v4_three ifconfig ${epair_two}b add vhid 1 \
-	    peer 198.51.100.2 192.0.2.1/29
+	    peer 198.51.100.2 192.0.2.1/32
 
 	# Sanity check
 	atf_check -s exit:0 -o ignore jexec carp_uni_v4_two \
-	    ping -c 1 198.51.100.130
+	    ping -c 1 198.51.100.224
 
 	wait_for_carp carp_uni_v4_two ${epair_one}b \
 	    carp_uni_v4_three ${epair_two}b
 
+	# Setup RIPv2 route daemon
+	jexec carp_uni_v4_two routed -s -Pripv2
+	jexec carp_uni_v4_three routed -s -Pripv2
+	jexec carp_uni_v4_one routed -Pripv2
+
+	# XXX Wait for route propagation
+	sleep 3
+
 	atf_check -s exit:0 -o ignore jexec carp_uni_v4_one \
 	    ping -c 3 192.0.2.1
 
 	# Check that we remain in unicast when tweaking settings
 	atf_check -s exit:0 -o ignore \
 	    jexec carp_uni_v4_two ifconfig ${epair_one}b vhid 1 advskew 2
-	atf_check -s exit:0 -o match:"peer 198.51.100.130" \
+	atf_check -s exit:0 -o match:"peer 198.51.100.224" \
 	    jexec carp_uni_v4_two ifconfig ${epair_one}b
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502250401.51P41v1n086294>