Docker: fix WG routes added to the correct interface (br0 or eth0 or bond0)

This commit is contained in:
bergware
2023-12-28 11:45:57 +01:00
parent b2e5cdba73
commit 4e80ead785
+1 -1
View File
@@ -190,7 +190,7 @@ container_add_route(){
local PID=${CT[0]}
local NET=${CT[1]#*[}
local LAN=${NET%:*}
if [[ $PID -gt 0 && ($LAN == br0 || $LAN == eth0) ]]; then
if [[ $PID -gt 0 && "${LAN//[^[0-9]/}" == "0" ]]; then
local THISIP=$(sed -n '/^\[eth0\]$/,/^TYPE/p' $INI | grep -Pom1 '^IPADDR:0="\K[^"]+')
for CFG in /etc/wireguard/wg*.cfg ; do
local NETWORK=$(grep -Pom1 '^Network:0="\K[^"]+' $CFG)