Skip to content

Commit 5054094

Browse files
authored
Merge latest devel code to main (#24)
* Fixes some more interface handling bits * Fixes an MTU war between pfSense and wg-quick. wg-quick will now always honor pfSense for assigned interfaces, and only fall back to the default 1420 for unassigned interfaces * Syntax bug * Created a new global variable to generalize more things * Subtle improvements to bootstrapper * Working on package logging facility * Reverting some code removal that broke UI layout * Testing layout bug
1 parent 9858a01 commit 5054094

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

src/files/usr/local/pkg/wireguard/etc/rc.bootstrap_wireguard

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@
2020
* limitations under the License.
2121
*/
2222

23+
/*
24+
* This file absolutely cannot be dependent on the package! It must standalone,
25+
* and only depend on pfSense includes. This script protects the firewall from
26+
* being unable to boot in the event that the package is removed with wg
27+
* interfaces assigned to pfSenses interfaces.
28+
*/
29+
2330
// pfSense includes
2431
require_once('globals.inc');
2532
require_once('config.inc');
2633

27-
// This file absolutely cannot be dependent on the package! It must standalone and only depend on pfSense includes
34+
$ifconfig = '/sbin/ifconfig';
2835

2936
// This is a hack to get text onto the console during booting from a php-cgi script
3037
function print_message($message) {
@@ -39,19 +46,17 @@ function print_message($message) {
3946
}
4047

4148
// Nice to have some output when running manually after system startup for testing purposes
42-
$run_verbose = true;
49+
$verbose = !(platform_booting());
4350

4451
if (platform_booting()) {
4552

46-
$run_verbose = false;
47-
4853
print_message("Bootstrapping WireGuard interfaces... \n");
4954

5055
}
5156

52-
$verbose_pipe = ($run_verbose ? "" : " > /dev/null 2>&1");
57+
$verbose_pipe = ($verbose ? "" : " > /dev/null 2>&1");
5358

54-
$if_list = get_configured_interface_list_by_realif($disabled);
59+
$if_list = get_configured_interface_list_by_realif(true);
5560

5661
foreach ($if_list as $realif => $name) {
5762

@@ -60,10 +65,10 @@ foreach ($if_list as $realif => $name) {
6065
if (substr($realif, 0, 2) == "wg") {
6166

6267
// Let's create temporary lo loopback interfaces just to be safe
63-
exec("(/sbin/ifconfig {$ifname} || /sbin/ifconfig lo create name {$ifname})" . $verbose_pipe);
68+
exec("({$ifconfig} {$ifname} || {$ifconfig} lo create name {$ifname})" . $verbose_pipe);
6469

6570
// Add them to the 'wg' group so wg-quick(8) can tear them down later
66-
exec("/sbin/ifconfig {$ifname} group wg" . $verbose_pipe);
71+
exec("{$ifconfig} {$ifname} group wg" . $verbose_pipe);
6772

6873
}
6974

src/files/usr/local/share/pfSense-pkg-WireGuard/info.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
<pkginfolink>https://github.com/theonemcdonald/pfSense-pkg-WireGuard</pkginfolink>
1818
<version>%%PKGVERSION%%</version>
1919
<configurationfile>wireguard.xml</configurationfile>
20+
<logging>
21+
<facilityname>wireguard</facilityname>
22+
<logfilename>wireguard.log</logfilename>
23+
</logging>
2024
</package>
2125
</pfsensepkgs>

src/files/usr/local/www/wg/vpn_wg.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,26 @@
169169
</tbody>
170170
</table>
171171
</td>
172-
<?php
172+
<?php
173173
else:
174174
print('<td colspan="6">' . gettext("No peers have been configured") . '</td>');
175175
endif;
176176
?>
177177
</tr>
178178
<?php
179179
$i++;
180-
181-
endforeach;
182-
183-
endif;
184-
180+
endforeach; // $tunnelsa
185181
?>
186182
</tbody>
187183
</table>
188184
</div>
189185
</div>
190186

187+
188+
<?php
189+
endif;
190+
?>
191+
191192
<nav class="action-buttons">
192193
<a href="#" class="btn btn-info btn-sm" id="showpeers">
193194
<i class="fa fa-info icon-embed-btn"></i>

0 commit comments

Comments
 (0)