aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_fr.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-02-02 22:58:00 +0100
committerHarald Welte <laforge@osmocom.org>2021-02-08 18:36:21 +0100
commit9811f498d46dcea5c44b09b827a0bf5749e4345c (patch)
treec142b0482e042624865580db1f0b14d73b26f1cf /src/gb/gprs_ns2_fr.c
parent6972aedb51b17e15194a367c80deef8ac4f35f24 (diff)
ns2: Don't try to add packets to the backlog on real errors
When writing to the AF_PACKET socket, we have to distinguish the pseudo-errors like -ENOBUFS (where we do want to add to the backlog) from real errors like -ENETDOWN, -EMSGSIZE, ... where we don't want to add the failed packet to the backlog. Change-Id: Ibbb6805da0f118466c4c91e458e62b63b84cb794
Diffstat (limited to 'src/gb/gprs_ns2_fr.c')
-rw-r--r--src/gb/gprs_ns2_fr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 2662df68..93b7759b 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -311,10 +311,14 @@ static int fr_netif_write_one(struct gprs_ns2_vc_bind *bind, struct msgb *msg)
switch (errno) {
case EAGAIN:
case ENOBUFS:
+ /* not a real error, but more a normal event on AF_PACKET */
+ /* don't free the message and let the caller re-enqueue */
return -errno;
default:
+ /* an actual error, like -ENETDOWN, -EMSGSIZE */
LOGBIND(bind, LOGL_ERROR, "error during write to AF_PACKET: %s\n", strerror(errno));
- return -errno;
+ msgb_free(msg);
+ return 0;
}
} else {
/* short write */