Change in osmo-msc[master]: libmsc/ran_msg_a.c: refactor ran_a_decode_lcls_notification()

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon May 13 20:15:07 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13981 )

Change subject: libmsc/ran_msg_a.c: refactor ran_a_decode_lcls_notification()
......................................................................

libmsc/ran_msg_a.c: refactor ran_a_decode_lcls_notification()

We basically need to make sure that one of two possible IEs
is not NULL, while another is NULL (eXclusive OR). This can
be done using at least two conditional branches.

Change-Id: Ie0f9b5c1bbbfb744e0615da07d76037d91b0abc8
Fixes: CID#198444 Logically dead code
---
M src/libmsc/ran_msg_a.c
1 file changed, 3 insertions(+), 10 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c
index da32a84..21be896 100644
--- a/src/libmsc/ran_msg_a.c
+++ b/src/libmsc/ran_msg_a.c
@@ -375,13 +375,7 @@
 	struct ran_msg ran_dec_msg;
 
 	/* Either §3.2.2.119 LCLS-BSS-Status or §3.2.2.120 LCLS-Break-Request shall be present */
-	if ((!ie_lcls_bss_status && !ie_lcls_break_req)
-	    || (ie_lcls_bss_status && ie_lcls_break_req)) {
-		LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n");
-		return -EINVAL;
-	}
-
-	if (ie_lcls_bss_status) {
+	if (ie_lcls_bss_status && !ie_lcls_break_req) {
 		ran_dec_msg = (struct ran_msg){
 			.msg_type = RAN_MSG_LCLS_STATUS,
 			.msg_name = "BSSMAP LCLS Notification (LCLS Status)",
@@ -391,9 +385,7 @@
 			},
 		};
 		return ran_decoded(ran_dec, &ran_dec_msg);
-	}
-
-	if (ie_lcls_break_req) {
+	} else if (ie_lcls_break_req && !ie_lcls_bss_status) {
 		ran_dec_msg = (struct ran_msg){
 			.msg_type = RAN_MSG_LCLS_BREAK_REQ,
 			.msg_name = "BSSMAP LCLS Notification (LCLS Break Req)",
@@ -404,6 +396,7 @@
 		return ran_decoded(ran_dec, &ran_dec_msg);
 	}
 
+	LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n");
 	return -EINVAL;
 }
 

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0f9b5c1bbbfb744e0615da07d76037d91b0abc8
Gerrit-Change-Number: 13981
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190513/ef35a9ba/attachment.html>


More information about the gerrit-log mailing list