diff options
author | Harald Welte <laforge@osmocom.org> | 2021-05-11 16:33:07 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-05-13 18:11:53 +0200 |
commit | 0f769392a5587820c607a245e4fd3097019ee466 (patch) | |
tree | 2660dda63be97d4c78e750b3f7e560f2600a8888 | |
parent | e9b21ff256c4269bde090ca8e942c738f0da97c4 (diff) |
m3ua/sua: Add quirk for allowing inbound DAUD from SG in ASP role.
The M3UA RFC talks about this message being used in ASP->SG direction,
not the other way around.
Closes: OS#5147
Change-Id: I36ff172b47142a877b37bbd149073bef35b36a74
-rw-r--r-- | include/osmocom/sigtran/osmo_ss7.h | 2 | ||||
-rw-r--r-- | src/m3ua.c | 12 | ||||
-rw-r--r-- | src/osmo_ss7_vty.c | 12 | ||||
-rw-r--r-- | src/sua.c | 12 |
4 files changed, 29 insertions, 9 deletions
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 8370dd9..a799b04 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -433,6 +433,8 @@ struct osmo_ss7_asp { /*! Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP procedure */ #define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001 +/*! Accept DAUD in ASP role (RFC states only permitted in ASP->SG role) */ +#define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP 0x00000002 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer); int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, @@ -901,6 +901,18 @@ static int m3ua_rx_snm_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua) xua->hdr.msg_type); /* silently ignore those to not confuse the sender */ break; + case M3UA_SNM_DAUD: + /* RFC states only permitted in ASP->SG direction, not reverse. But some + * equipment still sends it to us as ASP ?!? */ + if (asp->cfg.quirks & OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP) { + LOGPASP(asp, DLM3UA, LOGL_NOTICE, "quirk daud_in_asp active: Accepting DAUD " + "despite being in ASP role\n"); + xua_snm_rx_daud(asp, xua); + } else { + LOGPASP(asp, DLM3UA, LOGL_ERROR, "DAUD not permitted in ASP role\n"); + return M3UA_ERR_UNSUPP_MSG_TYPE; + } + break; default: return M3UA_ERR_UNSUPP_MSG_TYPE; } diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index bc84bca..b2e3192 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -56,12 +56,14 @@ "IPA Multiplex (SCCP Lite)\n" static const struct value_string asp_quirk_names[] = { - { OSMO_SS7_ASP_QUIRK_NO_NOTIFY, "no_notify" }, + { OSMO_SS7_ASP_QUIRK_NO_NOTIFY, "no_notify" }, + { OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP, "daud_in_asp" }, { 0, NULL } }; static const struct value_string asp_quirk_descs[] = { { OSMO_SS7_ASP_QUIRK_NO_NOTIFY, "Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP" }, + { OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP, "Allow Rx of DAUD in ASP role" }, { 0, NULL } }; @@ -762,11 +764,7 @@ DEFUN_ATTR(asp_quirk, asp_quirk_cmd, CMD_ATTR_IMMEDIATE) { struct osmo_ss7_asp *asp = vty->index; -#if 0 /* we only have one quirk, so there is no argv[0] yet! */ int quirk = get_string_value(asp_quirk_names, argv[0]); -#else - int quirk = get_string_value(asp_quirk_names, "no_notify"); -#endif if (quirk < 0) return CMD_WARNING; @@ -781,11 +779,7 @@ DEFUN_ATTR(asp_no_quirk, asp_no_quirk_cmd, CMD_ATTR_IMMEDIATE) { struct osmo_ss7_asp *asp = vty->index; -#if 0 /* we only have one quirk, so there is no argv[0] yet! */ int quirk = get_string_value(asp_quirk_names, argv[0]); -#else - int quirk = get_string_value(asp_quirk_names, "no_notify"); -#endif if (quirk < 0) return CMD_WARNING; @@ -912,6 +912,18 @@ static int sua_rx_snm_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua) xua->hdr.msg_type); /* silently ignore those to not confuse the sender */ break; + case SUA_SNM_DAUD: + /* RFC states only permitted in ASP->SG direction, not reverse. But some + * equipment still sends it to us as ASP ?!? */ + if (asp->cfg.quirks & OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP) { + LOGPASP(asp, DLSUA, LOGL_NOTICE, "quirk daud_in_asp active: Accepting DAUD " + "despite being in ASP role\n"); + xua_snm_rx_daud(asp, xua); + } else { + LOGPASP(asp, DLSUA, LOGL_ERROR, "DAUD not permitted in ASP role\n"); + return SUA_ERR_UNSUPP_MSG_TYPE; + } + break; default: return SUA_ERR_UNSUPP_MSG_TYPE; } |