OPNsense Forum

English Forums => Virtual private networks => Topic started by: Patrick M. Hausen on July 31, 2023, 03:25:55 PM

Title: Wireguard interface numbers
Post by: Patrick M. Hausen on July 31, 2023, 03:25:55 PM
Hi!

Since when do the WireGuard interfaces start with wg1 instead of wg0? And why? Drives me up the walls. Network engineers count from 0.

Seriously this is just cosmetic but I spent a good half an hour searching for some leftover wg0 or some other mistake ...
Title: Re: Wireguard interface numbers
Post by: CJ on July 31, 2023, 04:22:32 PM
Did this change?  My wireguard interface is wg0 and has been since the initial setup a couple of years ago.
Title: Re: Wireguard interface numbers
Post by: Patrick M. Hausen on July 31, 2023, 04:25:25 PM
I deleted mine because of a completely new setup, created a new one - oops, "wg1". WTF? Any leftovers from the old "wg0"? Delete wg1, reboot, create new configuration - "wg1". Delete, search config directories for and config file remnants ... nothing.

So the change seems to be intentional.
Title: Re: Wireguard interface numbers
Post by: CJ on July 31, 2023, 04:31:29 PM
Interesting.  I'll have to keep an eye out for that as I work on my tutorials now that 23.7 is out.
Title: Re: Wireguard interface numbers
Post by: franco on July 31, 2023, 05:05:42 PM
https://github.com/opnsense/changelog/blob/6e864439f8e95e693deed1f7b1827ee6537b7e77/community/22.1/22.1.10#L32 ;)

It was done to appease PHP's increasing need to validate everything and throw warnings around like a strict typed language.


Cheers,
Franco
Title: Re: Wireguard interface numbers
Post by: Patrick M. Hausen on July 31, 2023, 06:23:35 PM
You could have switched to the === operator where appropriate.
Title: Re: Wireguard interface numbers
Post by: franco on July 31, 2023, 07:30:07 PM
Unfortunately PHP 7 sort of forced us into using empty() as a general check method for various reasons. One of the downsides of empty() is that "0" is evaluated to true making "0" handling harder than expect and with new restrictions in PHP 8 it tries to tie it down further and we don't want to change idioms for each major PHP iteration or write our own boilerplate access function library.


Cheers,
Franco