mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
Wireguard: add verification check
This commit is contained in:
@@ -148,10 +148,12 @@ function addDocker($vtun) {
|
||||
$error = dockerNet($vtun);
|
||||
}
|
||||
if (!$error && !isNet($network)) {
|
||||
[$device,$thisnet,$gateway] = thisNet();
|
||||
exec("ip -4 rule add from $network table $index");
|
||||
exec("ip -4 route add unreachable default table $index");
|
||||
exec("ip -4 route add $thisnet via $gateway dev $device table $index");
|
||||
[$device, $thisnet, $gateway] = thisNet();
|
||||
if (!empty($device) && !empty($thisnet) && !empty($gateway)) {
|
||||
exec("ip -4 rule add from $network table $index");
|
||||
exec("ip -4 route add unreachable default table $index");
|
||||
exec("ip -4 route add $thisnet via $gateway dev $device table $index");
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
@@ -277,12 +279,14 @@ function parseInput($vtun, &$input, &$x) {
|
||||
// add WG routing for docker containers. Only IPv4 supported
|
||||
[$index, $network] = newNet($vtun);
|
||||
[$device, $thisnet, $gateway] = thisNet();
|
||||
$conf[] = "PostUp=ip -4 route flush table $index";
|
||||
$conf[] = "PostUp=ip -4 route add default via $tunip dev $vtun table $index";
|
||||
$conf[] = "PostUp=ip -4 route add $thisnet via $gateway dev $device table $index";
|
||||
$conf[] = "PostDown=ip -4 route flush table $index";
|
||||
$conf[] = "PostDown=ip -4 route add unreachable default table $index";
|
||||
$conf[] = "PostDown=ip -4 route add $thisnet via $gateway dev $device table $index";
|
||||
if (!empty($device) && !empty($thisnet) && !empty($gateway)) {
|
||||
$conf[] = "PostUp=ip -4 route flush table $index";
|
||||
$conf[] = "PostUp=ip -4 route add default via $tunip dev $vtun table $index";
|
||||
$conf[] = "PostUp=ip -4 route add $thisnet via $gateway dev $device table $index";
|
||||
$conf[] = "PostDown=ip -4 route flush table $index";
|
||||
$conf[] = "PostDown=ip -4 route add unreachable default table $index";
|
||||
$conf[] = "PostDown=ip -4 route add $thisnet via $gateway dev $device table $index";
|
||||
}
|
||||
}
|
||||
$conf[] = "\n[Peer]";
|
||||
// add peers, this is only used for peer sections
|
||||
|
||||
Reference in New Issue
Block a user