This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16901 )
Change subject: sccp: Improve logging in sccp_to_xua_opt()
......................................................................
sccp: Improve logging in sccp_to_xua_opt()
Change-Id: Icb3f18f34ecfe0602c6e491b61107a30287dcafb
---
M include/osmocom/sccp/sccp_types.h
M src/sccp2sua.c
M src/sccp_types.c
3 files changed, 40 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/01/16901/1
diff --git a/include/osmocom/sccp/sccp_types.h b/include/osmocom/sccp/sccp_types.h
index 71cbb0f..f43f822 100644
--- a/include/osmocom/sccp/sccp_types.h
+++ b/include/osmocom/sccp/sccp_types.h
@@ -80,6 +80,10 @@
SCCP_PNC_LONG_DATA = 19,
};
+extern const struct value_string osmo_sccp_pnc_names[];
+static inline const char *osmo_sccp_pnc_name(enum sccp_message_types val)
+{ return get_value_string(osmo_sccp_pnc_names, val); }
+
/* Figure 3/Q.713 Called/calling party address */
enum {
SCCP_TITLE_IND_NONE = 0,
diff --git a/src/sccp2sua.c b/src/sccp2sua.c
index e68662f..b829cf6 100644
--- a/src/sccp2sua.c
+++ b/src/sccp2sua.c
@@ -711,10 +711,11 @@
oneopt = opt_start;
+ enum sccp_parameter_name_codes opt_type = 0; /* dummy value not used */
while (oneopt < msg->tail) {
- enum sccp_parameter_name_codes opt_type = oneopt[0];
uint8_t opt_len;
uint16_t opt_len16;
+ opt_type = oneopt[0];
switch (opt_type) {
case SCCP_PNC_END_OF_OPTIONAL:
@@ -722,25 +723,30 @@
case SCCP_PNC_LONG_DATA:
/* two byte length field */
if (oneopt + 2 > msg->tail)
- return NULL;
+ goto malformed;
opt_len16 = oneopt[1] << 8 | oneopt[2];
if (oneopt + 3 + opt_len16 > msg->tail)
- return NULL;
+ goto malformed;
xua_msg_add_sccp_opt(xua, opt_type, opt_len16, oneopt+3);
oneopt += 3 + opt_len16;
break;
default:
/* one byte length field */
if (oneopt + 1 > msg->tail)
- return NULL;
+ goto malformed;
opt_len = oneopt[1];
if (oneopt + 2 + opt_len > msg->tail)
- return NULL;
+ goto malformed;
xua_msg_add_sccp_opt(xua, opt_type, opt_len, oneopt+2);
oneopt += 2 + opt_len;
}
}
+ LOGP(DLSUA, LOGL_ERROR, "Parameter %s not found\n", osmo_sccp_pnc_name(SCCP_PNC_END_OF_OPTIONAL));
+ return NULL;
+
+malformed:
+ LOGP(DLSUA, LOGL_ERROR, "Malformed parameter %s (%d)\n", osmo_sccp_pnc_name(opt_type), opt_type);
return NULL;
}
diff --git a/src/sccp_types.c b/src/sccp_types.c
index efe9aca..9370f9a 100644
--- a/src/sccp_types.c
+++ b/src/sccp_types.c
@@ -24,3 +24,28 @@
OSMO_VALUE_STRING(SCCP_MSG_TYPE_LUDTS),
{}
};
+
+/* Table 2/Q.713 - SCCP parameter name codes */
+const struct value_string osmo_sccp_pnc_names[] = {
+ OSMO_VALUE_STRING(SCCP_PNC_END_OF_OPTIONAL),
+ OSMO_VALUE_STRING(SCCP_PNC_DESTINATION_LOCAL_REFERENCE),
+ OSMO_VALUE_STRING(SCCP_PNC_SOURCE_LOCAL_REFERENCE),
+ OSMO_VALUE_STRING(SCCP_PNC_CALLED_PARTY_ADDRESS),
+ OSMO_VALUE_STRING(SCCP_PNC_CALLING_PARTY_ADDRESS),
+ OSMO_VALUE_STRING(SCCP_PNC_PROTOCOL_CLASS),
+ OSMO_VALUE_STRING(SCCP_PNC_SEGMENTING),
+ OSMO_VALUE_STRING(SCCP_PNC_RECEIVE_SEQ_NUMBER),
+ OSMO_VALUE_STRING(SCCP_PNC_SEQUENCING),
+ OSMO_VALUE_STRING(SCCP_PNC_CREDIT),
+ OSMO_VALUE_STRING(SCCP_PNC_RELEASE_CAUSE),
+ OSMO_VALUE_STRING(SCCP_PNC_RETURN_CAUSE),
+ OSMO_VALUE_STRING(SCCP_PNC_RESET_CAUSE),
+ OSMO_VALUE_STRING(SCCP_PNC_ERROR_CAUSE),
+ OSMO_VALUE_STRING(SCCP_PNC_REFUSAL_CAUSE),
+ OSMO_VALUE_STRING(SCCP_PNC_DATA),
+ OSMO_VALUE_STRING(SCCP_PNC_SEGMENTATION),
+ OSMO_VALUE_STRING(SCCP_PNC_HOP_COUNTER),
+ OSMO_VALUE_STRING(SCCP_PNC_IMPORTANCE),
+ OSMO_VALUE_STRING(SCCP_PNC_LONG_DATA),
+ {}
+};
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16901
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Icb3f18f34ecfe0602c6e491b61107a30287dcafb
Gerrit-Change-Number: 16901
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200116/9b8638a9/attachment.htm>