From df23ef46de765ef30332ed915eda5fe731c4fe0b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 13 Apr 2021 22:03:08 -0600 Subject: if_wg: allow debugging with `ifconfig wg0 debug` This is better than a custom sysctl. Signed-off-by: Jason A. Donenfeld --- src/if_wg.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') 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] -- cgit v1.2.3-59-g8ed1b