This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: IPA: Override/Set point codes ...................................................................... IPA: Override/Set point codes As an IPA SCCPlite message arrives without any MTP routing label, we simply construct one artificially for all inbound IPA/SCCPlite packets: * we set the SPC to the point-code of the routing key of the AS (as this is the PC we route to this IPA/SCCPlite client anyway) * we set the DPC to a point-code from a new vty config command "point-code override dpc" Change-Id: Id556398e1ded3e613cfde7ea8b71aff7a414ff90 --- M include/osmocom/sigtran/osmo_ss7.h M src/ipa.c M src/osmo_ss7_vty.c 3 files changed, 64 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 2ae4c1e..7b0a607 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -291,6 +291,9 @@ enum osmo_ss7_as_traffic_mode mode; uint32_t recovery_timeout_msec; uint8_t qos_class; + struct { + uint32_t dpc; + } pc_override;; struct osmo_ss7_asp *asps[16]; } cfg; diff --git a/src/ipa.c b/src/ipa.c index 1668f0f..df3dbd1 100644 --- a/src/ipa.c +++ b/src/ipa.c @@ -116,10 +116,33 @@ return 0; } +static struct osmo_ss7_as *find_as_for_asp(struct osmo_ss7_asp *asp) +{ + struct osmo_ss7_as *as; + + /* in the IPA case, weassume there is a 1:1 mapping between the + * ASP and the AS. An AS without ASP means there is no + * connection, and an ASP without AS means that we don't (yet?) + * know the identity of the peer */ + + llist_for_each_entry(as, &asp->inst->as_list, list) { + if (osmo_ss7_as_has_asp(as, asp)) + return as; + } + return NULL; +} + static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg) { struct m3ua_data_hdr data_hdr; struct xua_msg *xua = xua_msg_alloc(); + struct osmo_ss7_as *as = find_as_for_asp(asp); + + if (!as) { + LOGPASP(asp, DLSS7, LOGL_ERROR, "Rx message for IPA ASP without AS?!\n"); + msgb_free(msg); + return -1; + } /* pull the IPA header */ msgb_pull_to_l2(msg); @@ -142,9 +165,18 @@ */ memset(&data_hdr, 0, sizeof(data_hdr)); - data_hdr.opc = 0;//FIXME; - data_hdr.dpc = 0;//FIXME; data_hdr.si = MTP_SI_SCCP; + if (asp->cfg.is_server) { + /* Source: the PC of the routing key */ + data_hdr.opc = as->cfg.routing_key.pc; + /* Destination: Based on VTY config */ + data_hdr.dpc = as->cfg.pc_override.dpc; + } else { + /* Source: Based on VTY config */ + data_hdr.opc = as->cfg.pc_override.dpc; + /* Destination: PC of the routing key */ + data_hdr.dpc = as->cfg.routing_key.pc; + } xua = m3ua_xfer_from_data(&data_hdr, msgb_l2(msg), msgb_l2len(msg)); return m3ua_hmdc_rx_from_l2(asp->inst, xua); diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index a6a0f5b..0ff9e76 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -789,6 +789,28 @@ return CMD_SUCCESS; } +DEFUN(as_pc_override, as_pc_override_cmd, + "point-code override dpc PC", + "Point Code Specific Features\n" + "Override (force) a point-code to hard-coded value\n" + "Override Source Point Code\n" + "Override Destination Point Code\n" + "New Point Code\n") +{ + struct osmo_ss7_as *as = vty->index; + uint32_t pc = osmo_ss7_pointcode_parse(as->inst, argv[0]); + + if (as->cfg.proto != OSMO_SS7_ASP_PROT_IPA) { + vty_out(vty, "Only IPA type AS support point-code override. " + "Be happy that you don't need it!%s", VTY_NEWLINE); + return CMD_WARNING; + } + + as->cfg.pc_override.dpc = pc; + + return CMD_SUCCESS; +} + static void write_one_as(struct vty *vty, struct osmo_ss7_as *as) { struct osmo_ss7_routing_key *rkey; @@ -826,6 +848,10 @@ if (rkey->ssn) vty_out(vty, " ssn %u", rkey->ssn); vty_out(vty, "%s", VTY_NEWLINE); + + if (as->cfg.pc_override.dpc) + vty_out(vty, " point-code override dpc %s%s", + osmo_ss7_pointcode_print(as->inst, as->cfg.pc_override.dpc), VTY_NEWLINE); } DEFUN(show_cs7_as, show_cs7_as_cmd, @@ -1012,6 +1038,7 @@ install_element(L_CS7_AS_NODE, &as_recov_tout_cmd); install_element(L_CS7_AS_NODE, &as_qos_class_cmd); install_element(L_CS7_AS_NODE, &as_rout_key_cmd); + install_element(L_CS7_AS_NODE, &as_pc_override_cmd); } void osmo_ss7_vty_init_asp(void) -- To view, visit https://gerrit.osmocom.org/2370 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id556398e1ded3e613cfde7ea8b71aff7a414ff90 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder