pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40006?usp=email )
Change subject: asp: Rename and clarify asp_id field
......................................................................
asp: Rename and clarify asp_id field
The asp_id (RFC4666 ASP Identifier) can be (and may be) different on
each SGP peer of an ASP. Previously, we were storing in the same field
the value provided by the peer, and using this same value when sending
our own ASP Identifier during ASPUP.
This was not causing a problem since actually we have no real way to set
asp_id_present on our own in ASP mode yet, so no local ASP Identifier is
ever being transmitted.
This patch renames the asp_id field to remote_asp_id, since that's the
meaning it has in almost all places where it is being used.
The only place where it is being used so far, during Tx ASPUP, has been
documented and disabled since in reality the asp_id_present was not set
as mentioned above.
Furthermore, the remote ASP Identifier we receive from the peer ASP is
actually meaningful within a given AS, meaning that if an ASP is part of
several AS, we should be storing 1 remote ASP identifier for each AS it
serves. This is documented in ss7_asp7.h for later
Change-Id: I8e4304099db6fb12cf4b40a5b9a4aa3a83c95fde
---
M src/ss7_asp.h
M src/xua_as_fsm.c
M src/xua_asp_fsm.c
3 files changed, 26 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/06/40006/1
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index df2f4c3..7a001e0 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -43,9 +43,15 @@
/*! pre-formatted human readable local/remote socket name */
char *sock_name;
- /* ASP Identifier for ASP-UP + NTFY */
- uint32_t asp_id;
- bool asp_id_present;
+ /* ASP Identifier for ASP-UP + NTFY, as received by the peer.
+ * (In IPA ASPs it's used internally to hold 4-bit SLS).
+ * FIXME: This should actually be stored in a AS-ASP relation, since it
+ * can be different per AS, see RFC4666 3.5.1
+ * "The optional ASP Identifier parameter contains a unique value that
+ * is locally significant among the ASPs that support an AS".
+ */
+ uint32_t remote_asp_id;
+ bool remote_asp_id_present;
/* Layer Manager to which we talk */
const struct osmo_xua_layer_manager *lm;
diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index 2034659..0493b9b 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -83,9 +83,9 @@
continue;
/* Optional: ASP Identifier (if sent in ASP-UP) */
- if (asp->asp_id_present) {
+ if (asp->remote_asp_id_present) {
npar->presence |= NOTIFY_PAR_P_ASP_ID;
- npar->asp_id = asp->asp_id;
+ npar->asp_id = asp->remote_asp_id;
} else
npar->presence &= ~NOTIFY_PAR_P_ASP_ID;
@@ -370,8 +370,8 @@
.status_info = M3UA_NOTIFY_I_OT_ALT_ASP_ACT,
};
- if (asp_cmp->asp_id_present)
- npar.asp_id = asp_cmp->asp_id;
+ if (asp_cmp->remote_asp_id_present)
+ npar.asp_id = asp_cmp->remote_asp_id;
for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
struct osmo_ss7_asp *asp = as->cfg.asps[i];
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 2a2681f..d1e8b24 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -215,8 +215,17 @@
/* RFC 3868 Ch. 3.5.1 */
xua->hdr = XUA_HDR(SUA_MSGC_ASPSM, SUA_ASPSM_UP);
/* Optional: ASP ID */
- if (asp->asp_id_present)
- xua_msg_add_u32(xua, SUA_IEI_ASP_ID, asp->asp_id);
+#if 0
+ /* TODO: RFC 4666 3.8.1:
+ * 'The "ASP Identifier Required" error is sent by an SGP in
+ * response to an ASP Up message that does not contain an ASP
+ * Identifier parameter when the SGP requires one. The ASP SHOULD
+ * resend the ASP Up message with an ASP Identifier.' */
+ if (ss7_asp_peer_requires_asp_id(asp)) { /* Maybe configure in VTY "asp"
node? */
+ asp_id = /* get a unique id of asp within as, eg. the index in as->asps[] */;
+ xua_msg_add_u32(xua, SUA_IEI_ASP_ID, asp_id);
+ }
+#endif
/* Optional: Info String */
break;
case XUA_ASP_E_ASPSM_ASPUP_ACK:
@@ -455,8 +464,8 @@
asp_id_ie = xua_msg_find_tag(data, SUA_IEI_ASP_ID);
/* Optional ASP Identifier: Store for NTFY */
if (asp_id_ie) {
- asp->asp_id = xua_msg_part_get_u32(asp_id_ie);
- asp->asp_id_present = true;
+ asp->remote_asp_id = xua_msg_part_get_u32(asp_id_ie);
+ asp->remote_asp_id_present = true;
}
/* send ACK */
peer_send(fi, XUA_ASP_E_ASPSM_ASPUP_ACK, NULL);
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40006?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I8e4304099db6fb12cf4b40a5b9a4aa3a83c95fde
Gerrit-Change-Number: 40006
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>