Skip to content

Commit d11748f

Browse files
committed
fix: Use host network mode as default to resolve WebRTC/UDP issues
- Change default network mode from 'bridge' to 'host' in action.yml and Dockerfile - Solves WebRTC "Send failed" errors without requiring privileged mode - Bypasses Docker NAT/connection tracking issues - Works in organizations that block privileged containers - Make sysctl optimizations conditional on privileged mode - Prevents "permission denied" errors in GitHub Actions - Only applies buffer tuning when privileged-mode is explicitly enabled - Shows informative messages about optimization status This ensures the action works out-of-the-box for WebRTC/UDP traffic without requiring special permissions or violating security policies.
1 parent 5f1ef10 commit d11748f

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ARG TEST_NODE_PORT=4723
1919
# Set environment variables
2020
ENV DEVICELAB_URL=${DEVICELAB_URL}
2121
ENV TEST_NODE_PORT=${TEST_NODE_PORT}
22-
ENV NETWORK_MODE=bridge
22+
ENV NETWORK_MODE=host
2323

2424
# Configure sysctl settings for better network performance
2525
# These will be applied if the container has the necessary privileges

action.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ inputs:
3434
network-mode:
3535
description: 'Docker network mode (bridge or host). Host mode provides better WebRTC/UDP performance'
3636
required: false
37-
default: 'bridge'
37+
default: 'host'
3838

3939
enable-network-monitor:
4040
description: 'Enable network statistics monitoring'
@@ -206,11 +206,18 @@ runs:
206206
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --privileged"
207207
fi
208208
209-
# Add sysctl capabilities for network tuning
210-
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.rmem_default=1048576"
211-
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.wmem_default=1048576"
212-
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.rmem_max=2097152"
213-
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.wmem_max=2097152"
209+
# Add sysctl capabilities for network tuning (only with privileged mode)
210+
# Note: sysctl requires privileged mode in GitHub Actions
211+
if [ "${{ inputs.privileged-mode }}" = "true" ]; then
212+
echo "📊 Adding sysctl network optimizations (privileged mode enabled)"
213+
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.rmem_default=1048576"
214+
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.wmem_default=1048576"
215+
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.rmem_max=2097152"
216+
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --sysctl net.core.wmem_max=2097152"
217+
else
218+
echo "ℹ️ Sysctl optimizations skipped (requires privileged mode)"
219+
echo " Using host network mode for WebRTC performance instead"
220+
fi
214221
215222
# Add environment variables
216223
DOCKER_RUN_CMD="$DOCKER_RUN_CMD -e NETWORK_MODE=${{ inputs.network-mode }}"

0 commit comments

Comments
 (0)