The branch main has been updated by kp:

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

commit ad1b5df8884c0fd7d265526a4980c1fd9c67fb90
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2025-07-22 16:20:56 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2025-07-28 14:36:54 +0000

    if_ovpn tests: basic float test case
    
    Reviewed by:    markj
    MFC after:      3 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D51469
---
 tests/sys/net/if_ovpn/if_ovpn.sh | 91 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh
index 26807a095455..c42344da1a3b 100644
--- a/tests/sys/net/if_ovpn/if_ovpn.sh
+++ b/tests/sys/net/if_ovpn/if_ovpn.sh
@@ -1314,6 +1314,96 @@ multihome6_cleanup()
        ovpn_cleanup
 }
 
+atf_test_case "float" "cleanup"
+float_head()
+{
+       atf_set descr 'Test peer float notification'
+       atf_set require.user root
+}
+
+float_body()
+{
+       ovpn_init
+
+       l=$(vnet_mkepair)
+
+       vnet_mkjail a ${l}a
+       jexec a ifconfig ${l}a 192.0.2.1/24 up
+       jexec a ifconfig lo0 127.0.0.1/8 up
+       vnet_mkjail b ${l}b
+       jexec b ifconfig ${l}b 192.0.2.2/24 up
+
+       # Sanity check
+       atf_check -s exit:0 -o ignore jexec a ping -c 1 192.0.2.2
+
+       ovpn_start a "
+               dev ovpn0
+               dev-type tun
+               proto udp4
+
+               cipher AES-256-GCM
+               auth SHA256
+
+               local 192.0.2.1
+               server 198.51.100.0 255.255.255.0
+               ca $(atf_get_srcdir)/ca.crt
+               cert $(atf_get_srcdir)/server.crt
+               key $(atf_get_srcdir)/server.key
+               dh $(atf_get_srcdir)/dh.pem
+
+               mode server
+               script-security 2
+               auth-user-pass-verify /usr/bin/true via-env
+               topology subnet
+
+               keepalive 2 10
+
+               management 192.0.2.1 1234
+       "
+       ovpn_start b "
+               dev tun0
+               dev-type tun
+
+               client
+
+               remote 192.0.2.1
+               auth-user-pass $(atf_get_srcdir)/user.pass
+
+               ca $(atf_get_srcdir)/ca.crt
+               cert $(atf_get_srcdir)/client.crt
+               key $(atf_get_srcdir)/client.key
+               dh $(atf_get_srcdir)/dh.pem
+
+               keepalive 2 10
+       "
+
+       # Give the tunnel time to come up
+       sleep 10
+
+       atf_check -s exit:0 -o ignore jexec b ping -c 3 198.51.100.1
+
+       # We expect the client on 192.0.2.2
+       if ! echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.2; then
+               atf_fail "Client not found in status list!"
+       fi
+
+       # Now change the client IP
+       jexec b ifconfig ${l}b 192.0.2.3/24 up
+
+       # And wait for keepalives to trigger the float notification
+       sleep 5
+
+       # So the client now has the new address in userspace
+       if ! echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.3; then
+               atf_fail "Client not found in status list!"
+       fi
+}
+
+float_cleanup()
+{
+       ovpn_cleanup
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case "4in4"
@@ -1332,4 +1422,5 @@ atf_init_test_cases()
        atf_add_test_case "destroy_unused"
        atf_add_test_case "multihome4"
        atf_add_test_case "multihome6"
+       atf_add_test_case "float"
 }

Reply via email to