Fix extracting a CIP mask from incoming calls

Not only the bit of the cip value has to be set, also
the more generic bearer service bit (not depending on HLC)
need to be set.
Without the fix valid calls got ignored.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
This commit is contained in:
Karsten Keil 2012-08-24 18:45:12 +02:00
parent 35e8fcea38
commit f66da21a40
3 changed files with 10 additions and 5 deletions

View File

@ -271,9 +271,10 @@ static void lPLCIInfoIndIE(struct lPLCI *lp, unsigned char ie, uint32_t mask, st
Send2Application(lp, mc);
}
uint16_t q931CIPValue(struct mc_buf * mc)
uint16_t q931CIPValue(struct mc_buf * mc, uint32_t *m)
{
uint16_t CIPValue = 0;
uint32_t CIPMask;
int capability, mode, rate, oct5;
int hlc = -1, ehlc = -1;
int ret, l;
@ -338,6 +339,8 @@ uint16_t q931CIPValue(struct mc_buf * mc)
return 0;
}
CIPMask = 1 << CIPValue;
if (mc->l3m->hlc) {
ret = mi_decode_hlc(mc->l3m, &hlc, &ehlc);
l = *mc->l3m->hlc;
@ -402,6 +405,9 @@ uint16_t q931CIPValue(struct mc_buf * mc)
} else
wprint("Cannot decode HLC %s return %d - %s\n", bdebug, ret, strerror(-ret));
}
CIPMask |= 1 << CIPValue;
if (m)
*m = CIPMask;
return CIPValue;
}
@ -968,7 +974,7 @@ static void plci_cc_setup_ind(struct FsmInst *fi, int event, void *arg)
// FIXME: CW
if (mc->l3m) {
mc->cmsg.CIPValue = q931CIPValue(mc);
mc->cmsg.CIPValue = q931CIPValue(mc, NULL);
if (mc->l3m->called_nr && *mc->l3m->called_nr)
mc->cmsg.CalledPartyNumber = mc->l3m->called_nr;
if (mc->l3m->called_sub && *mc->l3m->called_sub)

View File

@ -222,7 +222,7 @@ int lPLCICreate(struct lPLCI **, struct lController *, struct mPLCI *);
void lPLCI_free(struct lPLCI *);
void lPLCI_l3l4(struct lPLCI *, int, struct mc_buf *);
uint16_t lPLCISendMessage(struct lPLCI *, struct mc_buf *);
uint16_t q931CIPValue(struct mc_buf *);
uint16_t q931CIPValue(struct mc_buf *, uint32_t *);
struct mNCCI *getNCCI4addr(struct lPLCI *, uint32_t, int);
void lPLCIDelNCCI(struct mNCCI *);
struct mNCCI *ConnectB3Request(struct lPLCI *, struct mc_buf *);

View File

@ -151,9 +151,8 @@ static void plciHandleSetupInd(struct mPLCI *plci, int pr, struct mc_buf *mc)
uint8_t found = 0;
int ret;
CIPValue = q931CIPValue(mc);
CIPValue = q931CIPValue(mc, &CIPmask);
pc = plci->pc;
CIPmask = 1 << CIPValue;
dprint(MIDEBUG_PLCI, "PLCI %04x: Check CIPvalue %d (%08x) with CIPmask %08x\n", plci->plci, CIPValue, CIPmask, pc->CIPmask);
if (CIPValue && ((CIPmask & pc->CIPmask) || (pc->CIPmask & 1))) {
/* at least one Application is listen for this service */