pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/42537?usp=email )


Change subject: xua_asp_fsm: Include Routing Context IE in Err msg cuase 
Invalid Routing Context
......................................................................

xua_asp_fsm: Include Routing Context IE in Err msg cuase Invalid Routing Context

As per RFC4666 3.8.1:
"""
For this error, the invalid Routing Context(s) MUST be included in
the Error message.
"""

Change-Id: Ia8bff16248967209d73cd6d5b54ac30fda283247
---
M src/xua_asp_fsm.c
1 file changed, 14 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/37/42537/1

diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index d627795..8524c4d 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -304,7 +304,9 @@
        return osmo_ss7_asp_send(asp, msg);
 }

-static int peer_send_error(struct osmo_fsm_inst *fi, uint32_t err_code)
+/* Transmit an Error MGMT message (RFC4666 3.8.1)
+ * rctx_be and rctx_size is raw data as obtained from originating message with 
"xua_msg_find_tag(xua_in, M3UA_IEI_ROUTE_CTX)" */
+static int peer_send_error_ext(struct osmo_fsm_inst *fi, uint32_t err_code, 
const uint8_t *rctx_be, unsigned int rctx_size)
 {
        struct xua_asp_fsm_priv *xafp = fi->priv;
        struct osmo_ss7_asp *asp = xafp->asp;
@@ -317,6 +319,9 @@
        xua->hdr.version = SUA_VERSION;
        xua_msg_add_u32(xua, SUA_IEI_ERR_CODE, err_code);

+       if (rctx_be && rctx_size > 0)
+               xua_msg_add_data(xua, M3UA_IEI_ROUTE_CTX, rctx_size, rctx_be);
+
        msg = xua_to_msg(SUA_VERSION, xua);
        xua_msg_free(xua);
        if (!msg)
@@ -325,6 +330,11 @@
        return osmo_ss7_asp_send(asp, msg);
 }

+static int peer_send_error(struct osmo_fsm_inst *fi, uint32_t err_code)
+{
+       return peer_send_error_ext(fi, err_code, NULL, 0);
+}
+
 static void xua_t_ack_cb(void *data)
 {
        struct osmo_fsm_inst *fi = data;
@@ -703,13 +713,14 @@
                }
                if ((part = xua_msg_find_tag(xua_in, M3UA_IEI_ROUTE_CTX))) {
                        for (i = 0; i < part->len / sizeof(uint32_t); i++) {
-                               uint32_t rctx = osmo_load32be(&part->dat[i * 
sizeof(uint32_t)]);
+                               uint8_t *rctx_raw = &part->dat[i * 
sizeof(uint32_t)];
+                               uint32_t rctx = osmo_load32be(rctx_raw);
                                as = ss7_asp_find_as_by_rctx(asp, rctx);
                                if (!as) {
                                        LOGPFSML(fi, LOGL_NOTICE,
                                                 "ASPAC: Couldn't find any AS 
with rctx=%u. Check your config!\n",
                                                 rctx);
-                                       peer_send_error(fi, 
M3UA_ERR_INVAL_ROUT_CTX);
+                                       peer_send_error_ext(fi, 
M3UA_ERR_INVAL_ROUT_CTX, rctx_raw, sizeof(uint32_t));
                                        return;
                                }
                        }

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42537?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: Ia8bff16248967209d73cd6d5b54ac30fda283247
Gerrit-Change-Number: 42537
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to