GSUP: set default ipa-name at application level

Prior to this change, if there was no explicit ipa-name configuration
in OsmoMSC, OsmoHLR would see the GSUP connection as MSC-00-00-00-00-00-00.
However, this default is constructed somewhere deep in IPA libraries
and is not visible to the GSUP client application, in this case OsmoMSC.
This situation creates a problem for SMS-over-GSUP routing: when we get
MT-forwardSM.req from an SMSC, we have to send a GSUP response, and this
response needs to get back to the MT-sending SMSC.  Because OsmoHLR
applies only passive routing for these responses, we have to set
source_name when generating MT-forwardSM.res in OsmoMSC - but we cannot
do so if don't know our own IPA name.

Change the default OsmoMSC ipa-name from MSC-00-00-00-00-00-00 to
unnamed-MSC, mirroring OsmoHLR default of unnamed-HLR, and set it
at our application level rather than deep in the libraries.

Related: OS#6135
Change-Id: I7bacd001b81326c32bc262c7d0c0491ded822fa8
diff --git a/src/libmsc/msc_net_init.c b/src/libmsc/msc_net_init.c
index f63acf8..1fc712a 100644
--- a/src/libmsc/msc_net_init.c
+++ b/src/libmsc/msc_net_init.c
@@ -130,9 +130,15 @@
 	net->gcm = gsup_client_mux_alloc(net);
 	OSMO_ASSERT(net->gcm);
 
+	/* If no IPA name is configured, we need to provide a default
+	 * right here, in order for the defaulted name to get inserted
+	 * as source_name in GSUP response messages. */
+	if (!net->msc_ipa_name)
+		net->msc_ipa_name = "unnamed-MSC";
+
 	ipa_dev = talloc_zero(net->gcm, struct ipaccess_unit);
 	ipa_dev->unit_name = "MSC";
-	ipa_dev->serno = net->msc_ipa_name; /* NULL unless configured via VTY */
+	ipa_dev->serno = net->msc_ipa_name;
 	ipa_dev->swversion = PACKAGE_NAME "-" PACKAGE_VERSION;
 
 	*net->gcm = (struct gsup_client_mux){
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 70b3b6b..f693cb6 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -1991,7 +1991,7 @@
       "Set the IPA name of this MSC\n"
       "A unique name for this MSC. For example: PLMN + redundancy server number: MSC-901-70-0. "
       "This name is used for GSUP routing and must be set if more than one MSC is connected to the HLR. "
-      "The default is 'MSC-00-00-00-00-00-00'.\n")
+      "The default is 'unnamed-MSC'.\n")
 {
 	if (vty->type != VTY_FILE) {
 		vty_out(vty, "The IPA name cannot be changed at run-time; "
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index a1c4435..836de66 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -171,6 +171,7 @@
 hlr
  remote-ip 127.0.0.1
  remote-port 4222
+ ipa-name unnamed-MSC
 sgs
  local-port 29118
  local-ip 0.0.0.0