aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-06-20 01:26:26 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-06-22 09:13:46 +0200
commitedeb2a26c663085b3eae0a7eac6eb011a21ae7c3 (patch)
treed7b3897641f21260ebb5160934f593ed56b08351
parent74863b01d304beda59d7a7bc9cfa887683fedd95 (diff)
downloadpasst-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar.gz
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar.bz2
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar.lz
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar.xz
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.tar.zst
passt-edeb2a26c663085b3eae0a7eac6eb011a21ae7c3.zip
udp: Improve messages for errors getting errorsHEADmaster
If udp_sock_recverr() gets an error retrieving the error queue, or udp_sock_errs() gets an error reading the SO_ERROR sockopt, we log a message with err_perror(), That severity is reasonable - this is something going unexpectedly wrong host side, not merely a connection getting shut down because we hit a network error. However, the messages can be made more useful by linking them to the specific flow, and safer by ratelimiting them. Remove the places where we included the numerical value of the socket fd: that's rarely useful, especially now that we have the context about the flow the fd belonged to. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--udp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/udp.c b/udp.c
index d23163f..505e554 100644
--- a/udp.c
+++ b/udp.c
@@ -693,6 +693,7 @@ static int udp_sock_errs(const struct ctx *c, int s, flow_sidx_t sidx,
uint8_t pif, in_port_t port,
const struct timespec *now)
{
+ struct udp_flow *uflow = udp_at_sidx(sidx);
unsigned n_err = 0;
socklen_t errlen;
int rc, err;
@@ -709,18 +710,20 @@ static int udp_sock_errs(const struct ctx *c, int s, flow_sidx_t sidx,
errlen = sizeof(err);
if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &errlen) < 0 ||
errlen != sizeof(err)) {
- err_perror("Error reading SO_ERROR");
+ flow_perror_ratelimit(uflow, now, "Error reading SO_ERROR");
return -1; /* error reading error, unrecoverable */
}
if (err) {
- debug("Unqueued error on UDP socket %i: %s", s, strerror_(err));
+ flow_dbg(uflow, "Unqueued error on UDP socket: %s",
+ strerror_(err));
n_err++;
}
if (!n_err) {
/* EPOLLERR, but no errors to clear !? */
- err("EPOLLERR event without reported errors on socket %i", s);
+ flow_err_ratelimit(uflow, now,
+ "EPOLLERR event without reported errors");
return -1; /* no way to clear, unrecoverable */
}