diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-13 18:26:28 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-13 18:26:28 +0200 |
commit | 035f339fac8b74814a210d89f506882f4a0e29e3 (patch) | |
tree | c80180ad085bb547ad500e42f7db07a566614670 /sysdep/unix/wg_user.c | |
parent | 899b0ccad5d4bfeaad70293690f45273274c75e9 (diff) |
WIP close socket after reading result
Diffstat (limited to 'sysdep/unix/wg_user.c')
-rw-r--r-- | sysdep/unix/wg_user.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c index 1446d20b..4db04067 100644 --- a/sysdep/unix/wg_user.c +++ b/sysdep/unix/wg_user.c @@ -51,14 +51,17 @@ 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; } static void user_tx_hook(struct birdsock *bs) { - DBG(L_TRACE "WG: TX %p %d", bs, s->tpos - s->ttx); + log(L_TRACE "WG: TX %p %d", bs, bs->tpos - bs->ttx); } /* errno or zero if EOF */ @@ -263,7 +266,7 @@ wg_user_set_device(struct pool *pool, /* Send data, <0=err, >0=ok, 0=sleep */ DBG(L_TRACE "WG: send %d", res); if (res != 0) { - rfree(sock); + shutdown(sock->fd, SHUT_WR); } /* abort(); */ |