diff --git a/l2tpns.c b/l2tpns.c index 3d722e5..0caf17b 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -1301,7 +1301,20 @@ void tunnelsend(uint8_t * buf, uint16_t l, tunnelidt t) if (sendto(udpfd[tunnel[t].indexudp], buf, l, 0, (void *) &addr, sizeof(addr)) < 0) { - LOG(0, ntohs((*(uint16_t *) (buf + 6))), t, "Error sending data out tunnel: %s (udpfd=%d, buf=%p, len=%d, dest=%s)\n", + sessionidt s = ntohs((*(uint16_t *) (buf + 6))); + if (errno == EAGAIN) + { + static time_t lastwarn; + time_t newtime = time(NULL); + + if (lastwarn != newtime) + { + lastwarn = newtime; + LOG(0, 0, t, "Error sending data out tunnel: buffer full\n"); + } + } + else + LOG(0, s, t, "Error sending data out tunnel: %s (udpfd=%d, buf=%p, len=%d, dest=%s)\n", strerror(errno), udpfd[tunnel[t].indexudp], buf, l, inet_ntoa(addr.sin_addr)); STAT(tunnel_tx_errors); return;