summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-08-31 21:38:11 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2023-12-21 22:53:23 +0100
commit0a08aaa5b352d8d303b3315954354c1380b96bc2 (patch)
treebdbd4051580f5ac0f79eb04a0108e6a9ab8bbaa4 /sysdep
parent5e49217a9115fd08bb762004c7d3dad59d4f92c8 (diff)
Wg-user: debug
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/wg_user.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c
index 8ba7c4f8..a929b989 100644
--- a/sysdep/unix/wg_user.c
+++ b/sysdep/unix/wg_user.c
@@ -1,8 +1,11 @@
+#define LOCAL_DEBUG
+
#include <stdio.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
+#include <errno.h>
#include "lib/lists.h"
#include "lib/ip.h"
#include "lib/socket.h"
@@ -42,6 +45,7 @@ bool wg_has_userspace(const char *ifname)
else
{
DBG(L_TRACE "WG: no socket %s", tmp);
+ log(L_TRACE "WG: no socket %s", tmp);
return false;
}
}
@@ -50,7 +54,9 @@ bool wg_has_userspace(const char *ifname)
static
int user_rx_hook(struct birdsock *sk UNUSED, uint size UNUSED)
{
- DBG(L_TRACE "WG: RX %p %d", sk, size);
+ char buf[1024]="";
+ strncpy(buf, sk->rbuf, size);
+ log(L_TRACE "WG: RX %p %d '%s'", sk, size, buf);
rfree(sk);
return 1;
}
@@ -58,7 +64,7 @@ int user_rx_hook(struct birdsock *sk UNUSED, uint size UNUSED)
static
void user_tx_hook(struct birdsock *bs)
{
- DBG(L_TRACE "WG: TX %p %d", bs, bs->tpos - bs->ttx);
+ log(L_TRACE "WG: TX %p %d", bs, bs->tpos - bs->ttx);
uint size = (uintptr_t)bs->data;
@@ -265,7 +271,7 @@ wg_user_set_device(struct pool *pool,
uint size = tbsize;
int len = user_put_device(dev, &pos, &size);
- DBG(L_TRACE "WG: put %d %s", size, sock->tbuf);
+ log(L_TRACE "WG: put %d %d %s", len, size, sock->tbuf);
if (len < 0)
{
@@ -276,6 +282,7 @@ wg_user_set_device(struct pool *pool,
sock->data = (void*)(uintptr_t)size;
int res = sk_connect_unix(sock, path, pathlen);
+ log(L_TRACE "WG: socket %s %d %d %d %s %d %s %d", res<0?strerror(errno):NULL, res, res<0?errno:0, sock->fd, ifname, path[0], path + 1, pathlen);
DBG(L_TRACE "WG: socket %d %d %s", res, sock->fd, path);
if (res < 0)
{