Change in libosmocore[master]: ns2: Don't try to add packets to the backlog on real errors

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 8 18:37:45 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22709 )

Change subject: ns2: Don't try to add packets to the backlog on real errors
......................................................................

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
---
M src/gb/gprs_ns2_fr.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  daniel: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 2662df6..93b7759 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -311,10 +311,14 @@
 		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 */

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22709
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibbb6805da0f118466c4c91e458e62b63b84cb794
Gerrit-Change-Number: 22709
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210208/5f4e2e64/attachment.htm>


More information about the gerrit-log mailing list