diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-13 22:03:08 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-13 22:05:41 -0600 |
commit | df23ef46de765ef30332ed915eda5fe731c4fe0b (patch) | |
tree | 728650fabb9bc618db5a25d1867ba7c331e39c4e /src | |
parent | if_wg: remove peer marshalling from get request (diff) | |
download | wireguard-freebsd-df23ef46de765ef30332ed915eda5fe731c4fe0b.tar.xz wireguard-freebsd-df23ef46de765ef30332ed915eda5fe731c4fe0b.zip |
if_wg: allow debugging with `ifconfig wg0 debug`
This is better than a custom sysctl.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/if_wg.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/if_wg.c b/src/if_wg.c index cdd61be..2ca1493 100644 --- a/src/if_wg.c +++ b/src/if_wg.c @@ -100,7 +100,7 @@ __FBSDID("$FreeBSD$"); #define NEW_HANDSHAKE_TIMEOUT (REKEY_TIMEOUT + KEEPALIVE_TIMEOUT) #define UNDERLOAD_TIMEOUT 1 -#define DPRINTF(sc, ...) if (wireguard_debug) if_printf(sc->sc_ifp, ##__VA_ARGS__) +#define DPRINTF(sc, ...) if (sc->sc_ifp->if_flags & IFF_DEBUG) if_printf(sc->sc_ifp, ##__VA_ARGS__) /* First byte indicating packet type on the wire */ #define WG_PKT_INITIATION htole32(1) @@ -329,7 +329,6 @@ struct wg_softc { static int clone_count; static uma_zone_t ratelimit_zone; -static int wireguard_debug; static volatile unsigned long peer_counter = 0; static const char wgname[] = "wg"; static unsigned wg_osd_jail_slot; @@ -337,11 +336,7 @@ static unsigned wg_osd_jail_slot; static struct sx wg_sx; SX_SYSINIT(wg_sx, &wg_sx, "wg_sx"); -static LIST_HEAD(, wg_softc) wg_list = LIST_HEAD_INITIALIZER(wg_list); - -SYSCTL_NODE(_net, OID_AUTO, wg, CTLFLAG_RW, 0, "WireGuard"); -SYSCTL_INT(_net_wg, OID_AUTO, debug, CTLFLAG_RWTUN, &wireguard_debug, 0, - "enable debug logging"); +static LIST_HEAD(, wg_softc) wg_list = LIST_HEAD_INITIALIZER(wg_list); static TASKQGROUP_DEFINE(wg_tqg, mp_ncpus, 1); @@ -349,7 +344,6 @@ MALLOC_DEFINE(M_WG, "WG", "wireguard"); VNET_DEFINE_STATIC(struct if_clone *, wg_cloner); - #define V_wg_cloner VNET(wg_cloner) #define WG_CAPS IFCAP_LINKSTATE #define ph_family PH_loc.eight[5] |