mtp: Allow to send SCCP/ISUP to a specific endpoint
For a linkset define where SCCP/ISUP should be send. This config should probably move up to the application part when real work on the routing is done. Right now the sccp_opc/sccp_dpc need to stay inside the mtp_layer3.c to be able to send a TFA for the reachable OPC and it is easier to keep both (dpc/opc) in the same file.
This commit is contained in:
parent
53559b39e5
commit
60bc8e7dab
|
@ -52,8 +52,18 @@ struct mtp_link_set {
|
|||
char *name;
|
||||
|
||||
|
||||
/* routing info.. */
|
||||
int dpc, opc, sccp_opc, isup_opc;
|
||||
/**
|
||||
* Routing is very limited. We can only forward to one
|
||||
* other STP/Endpoint. For ISUP and SCCP we can statically
|
||||
* send it to another destination. We need to follow Q.704
|
||||
* more properly here.
|
||||
* DPC/OPC are the ones for the linkset,
|
||||
* sccp_dpc/isup_dpc are where we will send SCCP/ISUP messages
|
||||
* sccp_opc/isup_opc are what we announce in the TFP
|
||||
*/
|
||||
int dpc, opc;
|
||||
int sccp_dpc, isup_dpc;
|
||||
int sccp_opc, isup_opc;
|
||||
int ni;
|
||||
int spare;
|
||||
|
||||
|
|
|
@ -525,14 +525,18 @@ int mtp_link_set_submit_sccp_data(struct mtp_link_set *set, int sls, const uint8
|
|||
}
|
||||
|
||||
rate_ctr_inc(&set->ctrg->ctr[MTP_LSET_SCCP_OUT_MSG]);
|
||||
return mtp_int_submit(set, set->sccp_opc, set->dpc, sls, MTP_SI_MNT_SCCP, data, length);
|
||||
return mtp_int_submit(set, set->sccp_opc,
|
||||
set->sccp_dpc == -1 ? set->dpc : set->sccp_dpc,
|
||||
sls, MTP_SI_MNT_SCCP, data, length);
|
||||
}
|
||||
|
||||
int mtp_link_set_submit_isup_data(struct mtp_link_set *set, int sls,
|
||||
const uint8_t *data, unsigned int length)
|
||||
{
|
||||
rate_ctr_inc(&set->ctrg->ctr[MTP_LSET_ISUP_OUT_MSG]);
|
||||
return mtp_int_submit(set, set->isup_opc, set->dpc, sls, MTP_SI_MNT_ISUP, data, length);
|
||||
return mtp_int_submit(set, set->isup_opc,
|
||||
set->isup_dpc == -1 ? set->dpc : set->isup_dpc,
|
||||
sls, MTP_SI_MNT_ISUP, data, length);
|
||||
}
|
||||
|
||||
int mtp_link_set_send(struct mtp_link_set *set, struct msgb *msg)
|
||||
|
@ -648,6 +652,7 @@ struct mtp_link_set *mtp_link_set_alloc(struct bsc_data *bsc)
|
|||
|
||||
set->nr = bsc->num_linksets++;
|
||||
set->sccp_opc = set->isup_opc = -1;
|
||||
set->sccp_dpc = set->isup_dpc = -1;
|
||||
set->pcap_fd = bsc->pcap_fd;
|
||||
set->bsc = bsc;
|
||||
|
||||
|
|
|
@ -206,6 +206,14 @@ static void write_linkset(struct vty *vty, struct mtp_link_set *set)
|
|||
set->timeout_t18, VTY_NEWLINE);
|
||||
vty_out(vty, " mtp3 timeout t20 %d%s",
|
||||
set->timeout_t20, VTY_NEWLINE);
|
||||
if (set->sccp_dpc != -1)
|
||||
vty_out(vty, " mtp3 sccp dpc %d%s", set->sccp_dpc, VTY_NEWLINE);
|
||||
if (set->sccp_opc != -1)
|
||||
vty_out(vty, " mtp3 sccp opc %d%s", set->sccp_opc, VTY_NEWLINE);
|
||||
if (set->isup_dpc != -1)
|
||||
vty_out(vty, " mtp3 isup dpc %d%s", set->isup_dpc, VTY_NEWLINE);
|
||||
if (set->isup_opc != -1)
|
||||
vty_out(vty, " mtp3 isup opc %d%s", set->isup_opc, VTY_NEWLINE);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(set->supported_ssn); ++i) {
|
||||
if (!set->supported_ssn[i])
|
||||
|
@ -452,6 +460,78 @@ DEFUN(cfg_linkset_t20, cfg_linkset_t20_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_mtp3_isup_opc, cfg_linkset_mtp3_isup_opc_cmd,
|
||||
"mtp3 isup opc <0-8191>",
|
||||
"MTP Level3\n" "ISUP Commands\n" "OPC\n" "OPC Number\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->isup_opc = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_no_mtp3_isup_opc, cfg_linkset_no_mtp3_isup_opc_cmd,
|
||||
"no mtp3 isup opc",
|
||||
NO_STR "MTP Level3\n" "ISUP Commands\n" "OPC\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->isup_opc = -1;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_mtp3_isup_dpc, cfg_linkset_mtp3_isup_dpc_cmd,
|
||||
"mtp3 isup dpc <0-8191>",
|
||||
"MTP Level3\n" "ISUP Commands\n" "DPC\n" "DPC Number\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->isup_dpc = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_no_mtp3_isup_dpc, cfg_linkset_no_mtp3_isup_dpc_cmd,
|
||||
"no mtp3 isup dpc",
|
||||
NO_STR "MTP Level3\n" "ISUP Commands\n" "DPC\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->isup_dpc = -1;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_mtp3_sccp_opc, cfg_linkset_mtp3_sccp_opc_cmd,
|
||||
"mtp3 sccp opc <0-8191>",
|
||||
"MTP Level3\n" "SCCP Commands\n" "OPC\n" "OPC Number\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->sccp_opc = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_no_mtp3_sccp_opc, cfg_linkset_no_mtp3_sccp_opc_cmd,
|
||||
"no mtp3 sccp opc",
|
||||
NO_STR "MTP Level3\n" "SCCP Commands\n" "OPC\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->sccp_opc = -1;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_mtp3_sccp_dpc, cfg_linkset_mtp3_sccp_dpc_cmd,
|
||||
"mtp3 sccp dpc <0-8191>",
|
||||
"MTP Level3\n" "SCCP Commands\n" "DPC\n" "DPC Number\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->sccp_dpc = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_no_mtp3_sccp_dpc, cfg_linkset_no_mtp3_sccp_dpc_cmd,
|
||||
"no mtp3 sccp dpc",
|
||||
NO_STR "MTP Level3\n" "SCCP Commands\n" "DPC\n")
|
||||
{
|
||||
struct mtp_link_set *set = vty->index;
|
||||
set->sccp_dpc = -1;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_linkset_link, cfg_linkset_link_cmd,
|
||||
"link <0-100>",
|
||||
"Link\n" "Link number\n")
|
||||
|
@ -943,6 +1023,14 @@ void cell_vty_init(void)
|
|||
install_element(LINKSETS_NODE, &cfg_linkset_sltm_once_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_t18_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_t20_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_mtp3_isup_opc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_no_mtp3_isup_opc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_mtp3_sccp_opc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_no_mtp3_sccp_opc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_mtp3_isup_dpc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_no_mtp3_isup_dpc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_mtp3_sccp_dpc_cmd);
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_no_mtp3_sccp_dpc_cmd);
|
||||
|
||||
install_element(LINKSETS_NODE, &cfg_linkset_link_cmd);
|
||||
install_node(&link_node, dummy_write);
|
||||
|
|
Reference in New Issue