Skip to content

Commit

Permalink
net/wireguard - minor regressions in refactory. ref https://www.reddi…
Browse files Browse the repository at this point in the history
  • Loading branch information
AdSchellevis committed Aug 30, 2023
1 parent cc4309f commit a5131fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions net/wireguard/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PLUGIN_NAME= wireguard
PLUGIN_VERSION= 2.0
PLUGIN_REVISION= 1
PLUGIN_COMMENT= WireGuard VPN service kernel implementation
PLUGIN_DEPENDS= wireguard-kmod
PLUGIN_CONFLICTS= wireguard-go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function wg_start($server, $fhandle)
mwexecf('/usr/bin/wg setconf %s %s', [$server->interface, $server->cnfFilename]);

foreach (explode(',', (string)$server->tunneladdress) as $alias) {
mwexecf('/sbin/ifconfig %s %s alias', [$server->interface, $alias]);
$proto = strpos($alias, ':') === false ? "inet" : "inet6";
mwexecf('/sbin/ifconfig %s %s %s alias', [$server->interface, $proto, $alias]);
}
if (!empty((string)$server->mtu)) {
mwexecf('/sbin/ifconfig %s mtu %s', [$server->interface, $server->mtu]);
Expand Down Expand Up @@ -87,7 +88,7 @@ function wg_start($server, $fhandle)
} elseif (!empty((string)$server->gateway)) {
/* Only bind the gateway ip to the tunnel */
$ipprefix = strpos($tunneladdress, ":") === false ? "-4" : "-6 ";
mwexecf('/sbin/route -q -n add -%s %s -iface %s', [$ipprefix, $server->gateway, $server->interface]);
mwexecf('/sbin/route -q -n add %s %s -iface %s', [$ipprefix, $server->gateway, $server->interface]);
}

// flush checksum to ease change detection
Expand Down

0 comments on commit a5131fe

Please sign in to comment.