aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_sndcp.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-02 12:40:48 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-02 12:40:48 +0200
commit614445206891ebdf33a7d88c6a304f4f6b713d4f (patch)
treee5c8dcfcea4bf8e2b97af70b4c308921fe404457 /openbsc/src/gprs/gprs_sndcp.c
parent858491821f72af4dcb63d8af66d45b7aa7b231e1 (diff)
[GPRS] SNDCP: Add new SNDCP Entity to global list of entities
Also, don't reject SN-PDUs with positive packet length.
Diffstat (limited to 'openbsc/src/gprs/gprs_sndcp.c')
-rw-r--r--openbsc/src/gprs/gprs_sndcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c
index debadbae1..12ad1a631 100644
--- a/openbsc/src/gprs/gprs_sndcp.c
+++ b/openbsc/src/gprs/gprs_sndcp.c
@@ -140,14 +140,16 @@ static struct sndcp_entity *sndcp_entity_alloc(struct gprs_llc_lle *lle,
//sne->fqueue.timer.cb = FIXME;
sne->rx_state = SNDCP_RX_S_FIRST;
+ llist_add(&sne->list, &sndcp_entities);
+
return sne;
}
/* Entry point for the SNSM-ACTIVATE.indication */
int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi)
{
- LOGP(DSNDCP, LOGL_INFO, "SNSM-ACTIVATE.ind (TLLI=%08x, NSAPI=%u)\n",
- lle->llme->tlli, nsapi);
+ LOGP(DSNDCP, LOGL_INFO, "SNSM-ACTIVATE.ind (lle=%p TLLI=%08x, "
+ "SAPI=%u, NSAPI=%u)\n", lle, lle->llme->tlli, lle->sapi, nsapi);
if (sndcp_entity_by_lle(lle, nsapi)) {
LOGP(DSNDCP, LOGL_ERROR, "Trying to ACTIVATE "
@@ -187,7 +189,8 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t *hd
sne = sndcp_entity_by_lle(lle, sch->nsapi);
if (!sne) {
LOGP(DSNDCP, LOGL_ERROR, "Message for non-existing SNDCP Entity "
- "(TLLI=%08x, NSAPI=%u)\n", lle->llme->tlli, sch->nsapi);
+ "(lle=%p, TLLI=%08x, SAPI=%u, NSAPI=%u)\n", lle,
+ lle->llme->tlli, lle->sapi, sch->nsapi);
return -EIO;
}
@@ -206,7 +209,7 @@ int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t *hd
npdu_num = (suh->npdu_high << 8) | suh->npdu_low;
npdu = (uint8_t *)suh + sizeof(*suh);
npdu_len = (msg->data + msg->len) - npdu;
- if (npdu_len) {
+ if (npdu_len <= 0) {
LOGP(DSNDCP, LOGL_ERROR, "Short SNDCP N-PDU: %d\n", npdu_len);
return -EIO;
}