Skip to content

Commit 4e3301d

Browse files
committed
Refactoring
1 parent 6bb691e commit 4e3301d

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ services:
44
container_name: cloudflare-warp-client
55
restart: unless-stopped
66

7-
# NET_ADMIN is required for WARP to create tunnel interfaces.
8-
# SYS_MODULE allows loading kernel modules (e.g. wireguard) if needed.
7+
# privileged is required so the container can write net.ipv4.conf.all.rp_filter=0
8+
# and have it stick. Docker daemon continuously resets rp_filter=2 on bridge
9+
# interfaces it manages; without privileged the container's proc writes are
10+
# blocked or immediately overridden. cap_add entries are kept for clarity.
11+
privileged: true
912
cap_add:
1013
- NET_ADMIN
1114
- NET_RAW

entrypoint.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,32 @@ warp-cli --accept-tos connect
109109

110110
echo "[info] WARP mesh connector is up and running."
111111

112+
# ---------------------------------------------------------------------------
113+
# rp_filter keeper
114+
#
115+
# Docker daemon writes net.ipv4.conf.all.rp_filter=2 whenever it manages its
116+
# bridge networks. Because the effective rp_filter per interface is
117+
# MAX(conf/all, conf/<iface>), all=2 overrides any per-interface setting of 0.
118+
# This keeper re-applies 0 every 5 seconds so Docker's resets are corrected
119+
# before they can drop traffic. privileged: true in compose ensures the writes
120+
# are not blocked by capability or seccomp restrictions.
121+
# ---------------------------------------------------------------------------
122+
(
123+
LAN_IFACE=$(ip route show default 2>/dev/null | awk '/default/ {print $5}' | head -1)
124+
echo "[rp_filter-keeper] Starting. LAN interface: ${LAN_IFACE:-unknown}"
125+
while true; do
126+
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter 2>/dev/null || true
127+
echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter 2>/dev/null || true
128+
if [ -n "$LAN_IFACE" ] && [ -f "/proc/sys/net/ipv4/conf/${LAN_IFACE}/rp_filter" ]; then
129+
echo 0 > "/proc/sys/net/ipv4/conf/${LAN_IFACE}/rp_filter" 2>/dev/null || true
130+
fi
131+
if [ -f /proc/sys/net/ipv4/conf/CloudflareWARP/rp_filter ]; then
132+
echo 0 > /proc/sys/net/ipv4/conf/CloudflareWARP/rp_filter 2>/dev/null || true
133+
fi
134+
sleep 5
135+
done
136+
) &
137+
112138
# ---------------------------------------------------------------------------
113139
# Connectivity watchdog
114140
#

0 commit comments

Comments
 (0)