[S] Change in libosmo-sccp[master]: ipa: Fix client setting unit_id with ASP name instead of AS

2023-12-07 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email )

Change subject: ipa: Fix client setting unit_id with ASP name instead of AS
..

ipa: Fix client setting unit_id with ASP name instead of AS

This was broken since ever. The client was submitting the ASP name
 in the unit_id field during IPA handshake, and the server was
expecting it to contain the AS, so it failed with message:
"Cannot find any definition for IPA Unit Name '%s'" in
ipa_asp_fsm_wait_id_resp().

Fixes: 5f0a8df34cae20455a520c3a85cf94124f486bf2
Change-Id: I249964e171f578726439c40e01ae85aa447afada
---
M src/ipa.c
M src/xua_asp_fsm.c
M src/xua_internal.h
3 files changed, 26 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/ipa.c b/src/ipa.c
index a77d331..82ece8b 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -131,7 +131,7 @@
return 0;
 }

-static struct osmo_ss7_as *find_as_for_asp(struct osmo_ss7_asp *asp)
+struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp)
 {
struct osmo_ss7_as *as;

@@ -216,7 +216,7 @@
int rc;
struct m3ua_data_hdr data_hdr;
struct xua_msg *xua;
-   struct osmo_ss7_as *as = find_as_for_asp(asp);
+   struct osmo_ss7_as *as = ipa_find_as_for_asp(asp);
uint32_t opc, dpc;

if (!as) {
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 2d81bc3..cc94ac7 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -1190,10 +1190,16 @@
 {
struct osmo_fsm_inst *fi;
struct ipa_asp_fsm_priv *iafp;
+   struct osmo_ss7_as *as = ipa_find_as_for_asp(asp);

/* allocate as child of AS? */
fi = osmo_fsm_inst_alloc(&ipa_asp_fsm, asp, NULL, log_level, 
asp->cfg.name);

+   if (!as) {
+   osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
+   return NULL;
+   }
+
iafp = talloc_zero(fi, struct ipa_asp_fsm_priv);
if (!iafp) {
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
@@ -1202,7 +1208,7 @@
iafp->role = role;
iafp->asp = asp;
iafp->ipa_unit = talloc_zero(iafp, struct ipaccess_unit);
-   iafp->ipa_unit->unit_name = talloc_strdup(iafp->ipa_unit, 
asp->cfg.name);
+   iafp->ipa_unit->unit_name = talloc_strdup(iafp->ipa_unit, as->cfg.name);
iafp->pong_timer.cb = ipa_pong_timer_cb;
iafp->pong_timer.data = fi;

diff --git a/src/xua_internal.h b/src/xua_internal.h
index 93f6140..b6b33af 100644
--- a/src/xua_internal.h
+++ b/src/xua_internal.h
@@ -117,6 +117,7 @@

 int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
 int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls);
+struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp);

 int osmo_isup_party_parse(char *out_digits, const uint8_t *in,
unsigned int in_num_bytes, bool odd);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I249964e171f578726439c40e01ae85aa447afada
Gerrit-Change-Number: 35255
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


[S] Change in libosmo-sccp[master]: ipa: Fix client setting unit_id with ASP name instead of AS

2023-12-07 Thread laforge
Attention is currently required from: daniel, pespin.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email )

Change subject: ipa: Fix client setting unit_id with ASP name instead of AS
..


Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
well, one can see from this that the typical setup of IPA/SCCPlite is to 
interface with some 3rd party equipment, and not between two 
osmocom/libosmo-sigtran using programs.



--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I249964e171f578726439c40e01ae85aa447afada
Gerrit-Change-Number: 35255
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Attention: pespin 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Thu, 07 Dec 2023 22:37:14 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: ipa: Fix client setting unit_id with ASP name instead of AS

2023-12-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email )


Change subject: ipa: Fix client setting unit_id with ASP name instead of AS
..

ipa: Fix client setting unit_id with ASP name instead of AS

This was broken since ever. The client was submitting the ASP name
 in the unit_id field during IPA handshake, and the server was
expecting it to contain the AS, so it failed with message:
"Cannot find any definition for IPA Unit Name '%s'" in
ipa_asp_fsm_wait_id_resp().

Fixes: 5f0a8df34cae20455a520c3a85cf94124f486bf2
Change-Id: I249964e171f578726439c40e01ae85aa447afada
---
M src/ipa.c
M src/xua_asp_fsm.c
M src/xua_internal.h
3 files changed, 26 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/55/35255/1

diff --git a/src/ipa.c b/src/ipa.c
index a77d331..82ece8b 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -131,7 +131,7 @@
return 0;
 }

-static struct osmo_ss7_as *find_as_for_asp(struct osmo_ss7_asp *asp)
+struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp)
 {
struct osmo_ss7_as *as;

@@ -216,7 +216,7 @@
int rc;
struct m3ua_data_hdr data_hdr;
struct xua_msg *xua;
-   struct osmo_ss7_as *as = find_as_for_asp(asp);
+   struct osmo_ss7_as *as = ipa_find_as_for_asp(asp);
uint32_t opc, dpc;

if (!as) {
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 2d81bc3..cc94ac7 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -1190,10 +1190,16 @@
 {
struct osmo_fsm_inst *fi;
struct ipa_asp_fsm_priv *iafp;
+   struct osmo_ss7_as *as = ipa_find_as_for_asp(asp);

/* allocate as child of AS? */
fi = osmo_fsm_inst_alloc(&ipa_asp_fsm, asp, NULL, log_level, 
asp->cfg.name);

+   if (!as) {
+   osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
+   return NULL;
+   }
+
iafp = talloc_zero(fi, struct ipa_asp_fsm_priv);
if (!iafp) {
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
@@ -1202,7 +1208,7 @@
iafp->role = role;
iafp->asp = asp;
iafp->ipa_unit = talloc_zero(iafp, struct ipaccess_unit);
-   iafp->ipa_unit->unit_name = talloc_strdup(iafp->ipa_unit, 
asp->cfg.name);
+   iafp->ipa_unit->unit_name = talloc_strdup(iafp->ipa_unit, as->cfg.name);
iafp->pong_timer.cb = ipa_pong_timer_cb;
iafp->pong_timer.data = fi;

diff --git a/src/xua_internal.h b/src/xua_internal.h
index 93f6140..b6b33af 100644
--- a/src/xua_internal.h
+++ b/src/xua_internal.h
@@ -117,6 +117,7 @@

 int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
 int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls);
+struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp);

 int osmo_isup_party_parse(char *out_digits, const uint8_t *in,
unsigned int in_num_bytes, bool odd);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35255?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I249964e171f578726439c40e01ae85aa447afada
Gerrit-Change-Number: 35255
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange