diff --git a/interface.c b/interface.c index 02f15ea2..bf6c67bf 100644 --- a/interface.c +++ b/interface.c @@ -511,6 +511,8 @@ interface_updown(struct interface *ifp, int up) ifp->numll = 0; } + ifp->flags &= ~IF_EDESTADDRREQ_SEEN; + local_notify_interface(ifp, LOCAL_CHANGE); return 1; diff --git a/interface.h b/interface.h index 2922e57b..d8ad9c7c 100644 --- a/interface.h +++ b/interface.h @@ -91,6 +91,8 @@ struct interface_conf { #define IF_DTLS (1 << 9) /* Announce v4-via-v6 routes through this interface. */ #define IF_V4VIAV6 (1 << 10) +/* Whether we've printed an error for EDESTADDRREQ already */ +#define IF_EDESTADDRREQ_SEEN (1 << 11) /* Only INTERFERING can appear on the wire. */ #define IF_CHANNEL_UNKNOWN 0 diff --git a/message.c b/message.c index 1722fbf8..aa2cb720 100644 --- a/message.c +++ b/message.c @@ -28,6 +28,8 @@ THE SOFTWARE. #include #include #include +#include +#include #include "babeld.h" #include "util.h" @@ -1153,8 +1155,22 @@ flushbuf(struct buffered *buf, struct interface *ifp) buf->buf, end, (struct sockaddr*)&buf->sin6, sizeof(buf->sin6)); - if(rc < 0) - perror("send"); + if(rc < 0) { + char *suppressed = ""; + if (errno == EDESTADDRREQ) { + if (ifp->flags & IF_EDESTADDRREQ_SEEN) + goto suppress_send_error; + ifp->flags |= IF_EDESTADDRREQ_SEEN; + suppressed = " (suppressed)"; + } + + fprintf(stderr, "send(%s%%%" PRIu32 "): %s%s\n", + format_address((unsigned char*)&buf->sin6.sin6_addr), + buf->sin6.sin6_scope_id, + strerror(errno), + suppressed); + } + suppress_send_error: } VALGRIND_MAKE_MEM_UNDEFINED(buf->buf, buf->size); buf->len = 0;