diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-28 10:08:14 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-28 10:08:14 +0200 |
commit | 3625038a118be1ce84bacec975e68e7c6b0e4f04 (patch) | |
tree | 525cefef8703d22d45f0651b0b576b90b6c52544 | |
parent | c9531203265d082b6984fef0a10c4982cd331cc3 (diff) |
[GPRS] NS: Print error message if TLV parser fails for some reason
-rw-r--r-- | openbsc/src/gprs/gprs_ns.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_ns.c b/openbsc/src/gprs/gprs_ns.c index 08a7c295..c5cf962f 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)) { |