Change in libosmocore[master]: gprs_ns2_fr: setup_device: allow to setup a device a fresh dahdi device

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Dec 22 14:45:10 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21845 )


Change subject: gprs_ns2_fr: setup_device: allow to setup a device a fresh dahdi device
......................................................................

gprs_ns2_fr: setup_device: allow to setup a device a fresh dahdi device

When a dahdi device hasn't been setupped yet, ioctl IF_GET_PROTO fails
with invalid argument.
Also fix the device check to skip ioctl's if the device is also in the
correct state.

Change-Id: I398d056546e35465a2944e1b4a86a8c93b3e5f7a
---
M src/gb/gprs_ns2_fr.c
1 file changed, 5 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/21845/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 1a6b92f..3435cf7 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -476,16 +476,17 @@
 	req.ifr_settings.size = sizeof(buffer);
 	req.ifr_settings.type = IF_GET_PROTO;
 
+	/* EINVAL is returned when no protocol has been set */
 	rc = ioctl(sock, SIOCWANDEV, &req);
-	if (rc < 0) {
+	if (rc < 0 && errno != EINVAL) {
 		LOGP(DLNS, LOGL_ERROR, "%s: Unable to get FR protocol information: %s\n",
 		     netif, strerror(errno));
 		goto err;
 	}
 
 	/* check if the device is good */
-	if (req.ifr_settings.type != IF_PROTO_FR && fr->lmi != LMI_NONE) {
-		LOGP(DLNS, LOGL_INFO, "%s: has correct frame relay mode and lmi\n", netif);
+	if (rc == 0 && req.ifr_settings.type == IF_PROTO_FR && fr->lmi == LMI_NONE) {
+		LOGP(DLNS, LOGL_NOTICE, "%s: has correct frame relay mode and lmi\n", netif);
 		goto ifup;
 	}
 
@@ -516,6 +517,7 @@
 	/* monitored events count */
 	fr->n393 = 4;
 
+	LOGP(DLNS, LOGL_ERROR, "%s: Setting frame relay related parameters\n", netif);
 	rc = ioctl(sock, SIOCWANDEV, &req);
 	if (rc) {
 		LOGP(DLNS, LOGL_ERROR, "%s: Unable to set FR protocol on information: %s\n",

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I398d056546e35465a2944e1b4a86a8c93b3e5f7a
Gerrit-Change-Number: 21845
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201222/19d9b7d3/attachment.htm>


More information about the gerrit-log mailing list