Change in libosmocore[master]: gprs_ns2: Fix yet another DSCP vs. TOS mix-up

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
Thu Apr 29 09:02:25 UTC 2021


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

Change subject: gprs_ns2: Fix yet another DSCP vs. TOS mix-up
......................................................................

gprs_ns2: Fix yet another DSCP vs. TOS mix-up

This is a follow-up to I64fee56b04d0ecd128bf661699d5071817ea96ec,
due to code duplication there was another code path that manually set
the IP_TOS socekt option that I missed in the first patch.

Related: OS#5136
Change-Id: I4bb22d0f67984077706b694eb7e75327b41b6fcf
---
M src/gb/gprs_ns2_udp.c
1 file changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index eb7d37b..22d371f 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -514,16 +514,18 @@
 	struct priv_bind *priv;
 	int rc = 0;
 
+	if (dscp < 0 || dscp > 63)
+		return -EINVAL;
+
 	OSMO_ASSERT(gprs_ns2_is_ip_bind(bind));
 	priv = bind->priv;
 
 	if (dscp != priv->dscp) {
 		priv->dscp = dscp;
 
-		rc = setsockopt(priv->fd.fd, IPPROTO_IP, IP_TOS,
-				&dscp, sizeof(dscp));
+		rc = osmo_sock_set_dscp(priv->fd.fd, dscp);
 		if (rc < 0) {
-			LOGBIND(bind, LOGL_ERROR, "Failed to set the DSCP to %d with ret(%d) errno(%d)\n",
+			LOGBIND(bind, LOGL_ERROR, "Failed to set the DSCP to %u with ret(%d) errno(%d)\n",
 				dscp, rc, errno);
 		}
 	}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4bb22d0f67984077706b694eb7e75327b41b6fcf
Gerrit-Change-Number: 23968
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
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/20210429/016b6170/attachment.htm>


More information about the gerrit-log mailing list