Skip to content

Commit

Permalink
Only print EDESTADDRREQ send error once
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielG committed Jul 19, 2023
1 parent 732be2e commit aa7d611
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,13 +1156,20 @@ flushbuf(struct buffered *buf, struct interface *ifp)
(struct sockaddr*)&buf->sin6,
sizeof(buf->sin6));
if(rc < 0) {
static int edestaddrreq_seen;
if (errno == EDESTADDRREQ) {
if (edestaddrreq_seen)
goto skip_send_error;
edestaddrreq_seen = 1;
}

char addr[INET6_ADDRSTRLEN+1];
uint32_t scope = buf->sin6.sin6_scope_id;
inet_ntop(AF_INET6, &buf->sin6.sin6_addr, addr, sizeof(addr));
fprintf(stderr, "send(%s%%%" PRIu32 "): %s\n",
addr, scope, strerror(errno));
}
skip_send_error:
}
VALGRIND_MAKE_MEM_UNDEFINED(buf->buf, buf->size);
buf->len = 0;
Expand Down

0 comments on commit aa7d611

Please sign in to comment.