Auto update wireguard tunnels when disabling/enabling bridging

This commit is contained in:
bergware
2023-08-15 14:39:30 +02:00
parent 29b96374f2
commit 9cd5518439

View File

@@ -20,7 +20,7 @@ $cfg = '/boot/config/network.cfg';
function update_wireguard($ifname) {
if (!in_array($ifname,['br0','bond0','eth0'])) return;
$nic = file_exists('/sys/class/net/br0') ? 'br0' : (file_exists('/sys/class/net/bond0') ? 'bond0' : 'eth0');
exec("wg show interfaces",$active);
exec("wg show interfaces|tr ' ' '\n'",$active);
foreach (glob("/etc/wireguard/*.conf",GLOB_NOSORT) as $wg) {
$vtun = basename($wg,'.conf');
// interface has changed?