aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-28 10:08:14 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-28 10:08:14 +0200
commitea985a43572a42cec3aaa17bb200b80e6aa98f4f (patch)
tree8b21955c06903db05ecb00d495e291ee5b1b719e /openbsc
parentdccf55535a868eae5aa350261ae4ab9b474f2e42 (diff)
[GPRS] NS: Print error message if TLV parser fails for some reason
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gprs/gprs_ns.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_ns.c b/openbsc/src/gprs/gprs_ns.c
index 08a7c2952..c5cf962f6 100644
--- a/openbsc/src/gprs/gprs_ns.c
+++ b/openbsc/src/gprs/gprs_ns.c
@@ -565,6 +565,12 @@ static int gprs_ns_rx_status(struct gprs_nsvc *nsvc, struct msgb *msg)
LOGP(DNS, LOGL_NOTICE, "NSEI=%u Rx NS STATUS ", nsvc->nsei);
rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0);
+ if (rc < 0) {
+ LOGPC(DNS, LOGL_NOTICE, "Error during TLV Parse\n");
+ LOGP(DNS, LOGL_ERROR, "NSEI=%u Rx NS STATUS: "
+ "Error during TLV Parse\n", nsvc->nsei);
+ return rc;
+ }
if (!TLVP_PRESENT(&tp, NS_IE_CAUSE)) {
LOGPC(DNS, LOGL_INFO, "missing cause IE\n");
@@ -587,6 +593,11 @@ static int gprs_ns_rx_reset(struct gprs_nsvc *nsvc, struct msgb *msg)
int rc;
rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0);
+ if (rc < 0) {
+ LOGP(DNS, LOGL_ERROR, "NSEI=%u Rx NS RESET "
+ "Error during TLV Parse\n", nsvc->nsei);
+ return rc;
+ }
if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) ||
!TLVP_PRESENT(&tp, NS_IE_VCI) ||
@@ -632,6 +643,11 @@ static int gprs_ns_rx_block(struct gprs_nsvc *nsvc, struct msgb *msg)
nsvc->state |= NSE_S_BLOCKED;
rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0);
+ if (rc < 0) {
+ LOGP(DNS, LOGL_ERROR, "NSEI=%u Rx NS BLOCK "
+ "Error during TLV Parse\n", nsvc->nsei);
+ return rc;
+ }
if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) ||
!TLVP_PRESENT(&tp, NS_IE_VCI)) {
@@ -691,6 +707,12 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
}
rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data,
msgb_l2len(msg), 0, 0);
+ rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0);
+ if (rc < 0) {
+ LOGP(DNS, LOGL_ERROR, "Rx NS RESET Error during "
+ "TLV Parse\n");
+ return rc;
+ }
if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) ||
!TLVP_PRESENT(&tp, NS_IE_VCI) ||
!TLVP_PRESENT(&tp, NS_IE_NSEI)) {