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

This commit is contained in:
bergware
2023-12-29 11:02:30 +01:00
parent a0e8bc32ea
commit b7b9d350e1

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//[^0-9]/}" == "0" ]]; then
if [[ $PID -gt 0 && "eth0 br0 bond0" =~ $LAN ]]; 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)