[PATCH] libosmocore[master]: GPRS: check and report local address used for NSE

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

Max gerrit-no-reply at lists.osmocom.org
Tue Oct 24 14:26:12 UTC 2017


Review at  https://gerrit.osmocom.org/4395

GPRS: check and report local address used for NSE

When dumping NSE via vty:
* check which local address would be used to communicate with a given
  NSE and print it
* print link layer type last to make output more consistent

Change-Id: I6932a29c7899d36bcc275f05dda9670b0e69bef0
Related: SYS#3610
---
M src/gb/gprs_ns_vty.c
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/4395/1

diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c
index 4ed4fef..c6fb141 100644
--- a/src/gb/gprs_ns_vty.c
+++ b/src/gb/gprs_ns_vty.c
@@ -35,7 +35,7 @@
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/gprs/gprs_ns.h>
 #include <osmocom/gprs/gprs_bssgp.h>
-
+#include <osmocom/core/socket.h>
 #include <osmocom/vty/vty.h>
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/logging.h>
@@ -158,17 +158,23 @@
 
 static void dump_nse(struct vty *vty, struct gprs_nsvc *nsvc, int stats)
 {
-	vty_out(vty, "NSEI %5u, NS-VC %5u, %5s %9s, Remote: %-4s, %5s %9s",
+	vty_out(vty, "NSEI %5u, NS-VC %5u, %5s %9s, ",
 		nsvc->nsei, nsvc->nsvci,
 		NS_DESC_A(nsvc->state),
-		NS_DESC_B(nsvc->state),
+		NS_DESC_B(nsvc->state));
+
+	if (nsvc->ll == GPRS_NS_LL_UDP) {
+		char local[INET6_ADDRSTRLEN + 1];
+		int rc = osmo_sock_local_ip((char *)&local, inet_ntoa(nsvc->ip.bts_addr.sin_addr));
+		vty_out(vty, "%s:%u ", (rc < 0) ? "unknown" : local, nsvc->nsi->nsip.local_port);
+	}
+
+	vty_out(vty, "Remote: %-4s, %5s %9s, %s ",
 		nsvc->remote_end_is_sgsn ? "SGSN" : "BSS",
 		NS_DESC_A(nsvc->remote_state),
-		NS_DESC_B(nsvc->remote_state));
+		NS_DESC_B(nsvc->remote_state), gprs_ns_ll_str(nsvc));
 
-	vty_out(vty, ", %s %s%s",
-		nsvc->ll == GPRS_NS_LL_UDP ? "UDP   " : "FR-GRE",
-		gprs_ns_ll_str(nsvc), VTY_NEWLINE);
+	vty_out(vty, "%s%s", nsvc->ll == GPRS_NS_LL_UDP ? "UDP" : "FR-GRE", VTY_NEWLINE);
 
 	if (stats) {
 		vty_out_rate_ctr_group(vty, " ", nsvc->ctrg);

-- 
To view, visit https://gerrit.osmocom.org/4395
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6932a29c7899d36bcc275f05dda9670b0e69bef0
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list