Change in osmo-gbproxy[master]: gb_proxy: fix wrong usage of bssgp_rim_ri_name()

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

daniel gerrit-no-reply at lists.osmocom.org
Thu Feb 11 11:07:48 UTC 2021


daniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gbproxy/+/22824 )

Change subject: gb_proxy: fix wrong usage of bssgp_rim_ri_name()
......................................................................

gb_proxy: fix wrong usage of bssgp_rim_ri_name()

In some logging statements the function bssgp_rim_ri_name() is used
twice. This is wrong since _name() functions use an internal buffer,
which can not be used twice in the same logging statement, so for the
affected log statements the function bssgp_rim_ri_name_buf() must be
used.

Change-Id: I8b6254a269770ddc141325d67d143f2a8130c519
Related: SYS#5103
---
M src/gb_proxy.c
1 file changed, 16 insertions(+), 6 deletions(-)

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



diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 4147d86..43d819d 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -897,6 +897,8 @@
 	struct bssgp_rim_routing_info dest_ri;
 	struct bssgp_rim_routing_info src_ri;
 	int rc;
+	char ri_src_str[64];
+	char ri_dest_str[64];
 
 	rc = bssgp_parse_rim_ri(&dest_ri, TLVP_VAL(&tp[0], BSSGP_IE_RIM_ROUTING_INFO),
 				TLVP_LEN(&tp[0], BSSGP_IE_RIM_ROUTING_INFO));
@@ -938,8 +940,10 @@
 			/* TODO: Also check if dest_cell->bss_bvc is RIM-capable (see also above). If not we should
 			 * respond with a BSSGP STATUS message as well because it also would make no sense to try
 			 * routing the RIM message to the next RIM-capable SGSN. */
-			LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying to peer (nsei=%u) RIM-PDU: src=%s, dest=%s\n", log_pfx, pdut_name,
-			     dest_cell->bss_bvc->nse->nsei, bssgp_rim_ri_name(&src_ri), bssgp_rim_ri_name(&dest_ri));
+			LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying to peer (nsei=%u) RIM-PDU: src=%s, dest=%s\n",
+			     log_pfx, pdut_name, dest_cell->bss_bvc->nse->nsei,
+			     bssgp_rim_ri_name_buf(ri_src_str, sizeof(ri_src_str), &src_ri),
+			     bssgp_rim_ri_name_buf(ri_dest_str, sizeof(ri_dest_str), &dest_ri));
 			return gbprox_relay2peer(msg, dest_cell->bss_bvc, 0);
 		}
 	}
@@ -954,8 +958,10 @@
 		     pdut_name, bssgp_rim_ri_name(&src_ri), bssgp_rim_ri_name(&dest_ri));
 		return bssgp_tx_status(BSSGP_CAUSE_UNKN_RIM_AI, NULL, msg);
 	}
-	LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying to SGSN(%05u/%s) RIM-PDU: src=%s, dest=%s\n", log_pfx, pdut_name,
-	     sgsn->nse->nsei, sgsn->name, bssgp_rim_ri_name(&src_ri), bssgp_rim_ri_name(&dest_ri));
+	LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying to SGSN(%05u/%s) RIM-PDU: src=%s, dest=%s\n",
+	     log_pfx, pdut_name, sgsn->nse->nsei, sgsn->name,
+	     bssgp_rim_ri_name_buf(ri_src_str, sizeof(ri_src_str), &src_ri),
+	     bssgp_rim_ri_name_buf(ri_dest_str, sizeof(ri_dest_str), &dest_ri));
 
 	return gbprox_relay2nse(msg, sgsn->nse, 0);
 }
@@ -1216,6 +1222,8 @@
 	struct bssgp_rim_routing_info dest_ri;
 	struct bssgp_rim_routing_info src_ri;
 	int rc;
+	char ri_src_str[64];
+	char ri_dest_str[64];
 
 	/* TODO: Reply with STATUS if BSSGP didn't negotiate RIM feature, see also comments in
 	   gbprox_rx_rim_from_bss() */
@@ -1253,8 +1261,10 @@
 	sgsn = gbproxy_sgsn_by_nsei(nse->cfg, nse->nsei);
 	OSMO_ASSERT(sgsn);
 
-	LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying from SGSN(%05u/%s) RIM-PDU: src=%s, dest=%s\n", log_pfx, pdut_name,
-	     sgsn->nse->nsei, sgsn->name, bssgp_rim_ri_name(&src_ri), bssgp_rim_ri_name(&dest_ri));
+	LOGP(DLBSSGP, LOGL_DEBUG, "%s %s relaying from SGSN(%05u/%s) RIM-PDU: src=%s, dest=%s\n",
+	     log_pfx, pdut_name, sgsn->nse->nsei, sgsn->name,
+	     bssgp_rim_ri_name_buf(ri_src_str, sizeof(ri_src_str), &src_ri),
+	     bssgp_rim_ri_name_buf(ri_dest_str, sizeof(ri_dest_str), &dest_ri));
 
 	return gbprox_relay2peer(msg, dest_cell->bss_bvc, 0);
 }

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

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I8b6254a269770ddc141325d67d143f2a8130c519
Gerrit-Change-Number: 22824
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
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/20210211/a45a5142/attachment.htm>


More information about the gerrit-log mailing list