Skip to content

Commit 04f05df

Browse files
authored
Merge pull request #271 from nextcloud/tflidd-patch-1
FreeBSD Gateway IP fix and add ipv6
2 parents 53d94d9 + 2e7beae commit 04f05df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/OperatingSystems/FreeBSD.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ public function getNetworkInfo(): array {
118118
$alldns = implode(' ', $matches[0]);
119119
$result['dns'] = $alldns;
120120
$netstat = $this->executeCommand('netstat -rn');
121-
preg_match("/(?<=^default).*\b\d/m", $netstat, $gw);
122-
$result['gateway'] = $gw[0];
121+
preg_match_all("/(?<=^default)\s*[0-9a-fA-f\.:]+/m", $netstat, $gw);
122+
if (count($gw[0]) > 0) {
123+
$result['gateway'] = implode(", ", array_map("trim", $gw[0]));
124+
}
123125
} catch (\RuntimeException $e) {
124126
return $result;
125127
}

0 commit comments

Comments
 (0)