Skip to content

Commit 0fb5e2f

Browse files
dguidoclaude
andcommitted
Add PersistentKeepalive to trigger WireGuard handshake
WireGuard only initiates a handshake when there's outgoing traffic or a keepalive timer fires. Without PersistentKeepalive, the test was waiting forever because no traffic was being sent through the tunnel (Table=off prevents route creation). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent eeb041d commit 0fb5e2f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/e2e/test-vpn-connectivity.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,17 @@ test_wireguard() {
252252
sed -i "s/Endpoint = localhost:/Endpoint = ${SERVER_BRIDGE_IP}:/" "${ns_config}"
253253
sed -i '/^DNS = /d' "${ns_config}"
254254

255-
# Add Table=off if not present
255+
# Add Table=off if not present (prevent routing table changes in namespace)
256256
if ! grep -q "^Table" "${ns_config}"; then
257257
sed -i '/^\[Interface\]/a Table = off' "${ns_config}"
258258
fi
259259

260+
# Add PersistentKeepalive to trigger handshake initiation
261+
# Without this, WireGuard waits for outgoing traffic before initiating
262+
if ! grep -q "^PersistentKeepalive" "${ns_config}"; then
263+
sed -i '/^\[Peer\]/a PersistentKeepalive = 1' "${ns_config}"
264+
fi
265+
260266
log_info "Modified WireGuard config for namespace testing"
261267
log_info "Endpoint changed to ${SERVER_BRIDGE_IP}"
262268

0 commit comments

Comments
 (0)