--- if_ovpn.c.orig 2023-11-10 07:07:53.000000000 +0700 +++ if_ovpn.c 2024-01-19 22:30:53.478336000 +0700 @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -276,6 +277,12 @@ SYSCTL_INT(_net_link_openvpn, OID_AUTO, netisr_queue, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(async_netisr_queue), 0, "Use netisr_queue() rather than netisr_dispatch()."); +VNET_DEFINE_STATIC(int, debug) = 0; +#define V_debug VNET(debug) +SYSCTL_INT(_net_link_openvpn, OID_AUTO, debug, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(debug), 0, + "Enable debug log"); + static int ovpn_peer_compare(struct ovpn_kpeer *a, struct ovpn_kpeer *b) { @@ -1412,7 +1419,10 @@ ovpn_ioctl_get(struct ifnet *ifp, struct ifdrv *ifd) if (len > ifd->ifd_len) { free(packed, M_NVLIST); nvlist_destroy(nvl); - return (ENOSPC); + if (V_debug) + log(LOG_DEBUG, "if_ovpn: len(%ju) > ifd->ifd_len(%ju)\n", + (uintmax_t)len, (uintmax_t)ifd->ifd_len); + return (ENOBUFS); } error = copyout(packed, ifd->ifd_data, len);