freetdm: ss7 - bug fixes in configuration

This commit is contained in:
Konrad Hammel 2010-09-09 17:31:27 -04:00
parent e7fecd0ff9
commit c4324d5af4
3 changed files with 46 additions and 56 deletions

View File

@ -213,7 +213,7 @@ int ft_to_sngss7_cfg_all(void)
SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x);
SS7_ASSERT
} else {
SS7_INFO("MTP3 ROUTE %d configuration DONE!\n");
SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x);
}
/* set the CONFIGURED flag */
@ -229,7 +229,7 @@ int ft_to_sngss7_cfg_all(void)
SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n");
SS7_ASSERT
} else {
SS7_INFO("MTP3 ROUTE %d configuration DONE!\n");
SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n");
}
/* set the CONFIGURED flag */
@ -925,7 +925,6 @@ int ftmod_ss7_mtp3_linkset_config(int id)
{
Pst pst;
SnMngmt cfg;
U16 c;
sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id];
/* initalize the post structure */
@ -953,10 +952,9 @@ int ftmod_ss7_mtp3_linkset_config(int id)
cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */
cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */
cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = 1; /* number of combined link sets */
for (c = 0; c < LSN_MAXCMBLNK; c++) {
cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = c+1;
cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0;
}
cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].cmbLnkSetId = k->cmbLinkSetId;
cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].lnkSetPrior = 0;
return(sng_cfg_mtp3(&pst, &cfg));
}

View File

@ -162,6 +162,7 @@ typedef struct sng_link_set {
uint32_t flags;
uint32_t apc;
uint32_t linkType;
uint32_t cmbLinkSetId;
uint32_t minActive;
uint32_t numLinks;
uint32_t links[16];
@ -176,6 +177,7 @@ typedef struct sng_route {
uint32_t linkType;
uint32_t switchType;
uint32_t ssf;
uint32_t nwId;
uint32_t isSTP;
uint32_t t6;
uint32_t t8;

View File

@ -665,7 +665,7 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)
mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.linkType;
mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.switchType;
mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.ssf;
mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id;
mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].cmbLinkSetId;
break;
}
x++;
@ -781,36 +781,25 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
/* check if the name matches */
if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpRoute[x].name, parm->val)) {
/* now, harvest the required information from the global structure */
sng_isup.mtpRouteId = g_ftdm_sngss7_data.cfg.mtpRoute[x].id;
sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[x].dpc;
sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType;
sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType;
/* find the nwID from the nsap */
int y = 1;
while (g_ftdm_sngss7_data.cfg.nsap[y].id != 0) {
if ((g_ftdm_sngss7_data.cfg.nsap[y].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) &&
(g_ftdm_sngss7_data.cfg.nsap[y].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) &&
(g_ftdm_sngss7_data.cfg.nsap[y].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) {
/* find the NSAP corresponding to this switchType and SSF */
int z = 1;
while (g_ftdm_sngss7_data.cfg.nsap[z].id != 0) {
if ((g_ftdm_sngss7_data.cfg.nsap[z].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) &&
(g_ftdm_sngss7_data.cfg.nsap[z].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) &&
(g_ftdm_sngss7_data.cfg.nsap[z].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) {
sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[z].nwId;
/* we have a match so break out of this loop */
break;
}
/* move on to the next one */
y++;
} /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) */
/* check how we exited the last while loop */
if (g_ftdm_sngss7_data.cfg.nsap[y].id == 0) {
SS7_ERROR("\tFailed to find the nwID for = \"%s\"!\n", parm->val);
return FTDM_FAIL;
} else {
sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[y].nwId;
z++;
}
break;
}
x++;
@ -867,8 +856,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
ftmod_ss7_fill_in_isup_interface(&sng_isup);
g_ftdm_sngss7_data.cfg.isap[sng_isap.id].spId = sng_isup.id;
return FTDM_SUCCESS;
}
@ -1074,6 +1061,7 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet)
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id;
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc;
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = g_ftdm_sngss7_data.cfg.mtpLink[1].mtp3.linkType; /* KONRAD FIX ME */
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].cmbLinkSetId = mtpLinkSet->id;
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive;
g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = mtpLinkSet->numLinks;
@ -1092,8 +1080,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)
/* go through all the existing routes and see if we find a match */
i = 1;
while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) {
if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == mtp3_route->dpc) {
if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpRoute[i].name, mtp3_route->name)) {
/* we have a match so break out of this loop */
break;
}
@ -1115,7 +1102,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)
g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc;
g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = mtp3_route->linkType;
g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType;
g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = 1; /* mtp3_route->cmbLinkSetId;*/
g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = mtp3_route->cmbLinkSetId;
g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP;
g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf;
if (mtp3_route->t6 != 0) {
@ -1222,7 +1209,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup)
/* go through all the existing interfaces and see if we find a match */
i = 1;
while (g_ftdm_sngss7_data.cfg.isupIntf[i].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupIntf[i].nwId == sng_isup->nwId) {
if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[i].name, sng_isup->name)) {
/* we have a match so break out of this loop */
break;
@ -1395,7 +1382,8 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap)
}
g_ftdm_sngss7_data.cfg.isap[i].id = sng_isap->id;
g_ftdm_sngss7_data.cfg.isap[i].suId = 1; /*KONRAD FIX ME */
g_ftdm_sngss7_data.cfg.isap[i].suId = sng_isap->id;
g_ftdm_sngss7_data.cfg.isap[i].spId = sng_isap->id;
g_ftdm_sngss7_data.cfg.isap[i].switchType = sng_isap->switchType;
g_ftdm_sngss7_data.cfg.isap[i].ssf = sng_isap->ssf;
@ -1513,7 +1501,9 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i
SS7_DEBUG("found existing mtp3 self route\n");
return FTDM_SUCCESS;
} else {
SS7_ERROR("found new mtp3 self route but it does not much the route already configured\n");
SS7_ERROR("found new mtp3 self route but it does not match the route already configured (dpc=%d:spc=%d)\n",
g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc,
spc);
return FTDM_FAIL;
}