diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2017-03-02 16:37:03 +0100 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2018-01-30 18:58:27 +0100 |
commit | c103ee2491cfad89ffbab00f49bcdcc78154ba5b (patch) | |
tree | 3ff701044c03514a4c2761fbca28cf5d223a0b47 /openbsc/src | |
parent | e47099fbbf9efa3b59f2bdc53ed5e396b7b21bd7 (diff) |
osmo-bsc_nat: Have a default MSC for messages from BSC
Change-Id: I343e6d9d17bcde6dbdf8f48b7b51e998a296680c
Ticket: SYS#3208
Sponsored-by: On-Waves ehf.
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat.c | 8 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 12 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 9 |
3 files changed, 26 insertions, 3 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 2b146faf0..6a0ec85f9 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -1156,11 +1156,13 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg) #warning Don't assert, fail gracefully! OSMO_ASSERT(con); -#warning Implement routing by IMSI - if (!imsi) - LOGP(DNAT, LOGL_ERROR, "No IMSI for CR\n"); con->msc_con = msc_conn_by_imsi(bsc->nat, imsi); + if (!con->msc_con) { + /* Fall back to default MSC */ + LOGP(DNAT, LOGL_NOTICE, "Falling back to default MSC\n"); + con->msc_con = msc_conn_by_num(bsc->nat, bsc->nat->default_msc); + } con_msc = con->msc_con; con->filter_state.con_type = con_type; con->filter_state.imsi_checked = filter; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 6655d43aa..830205b99 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -253,6 +253,18 @@ struct msc_config *msc_config_by_con(struct bsc_nat *nat, struct bsc_msc_connect return NULL; } +struct bsc_msc_connection *msc_conn_by_num(struct bsc_nat *nat, int num) +{ + struct msc_config *conf; + + conf = msc_config_num(nat, num); + + if (!conf) + return NULL; + + return conf->msc_con; +} + struct bsc_msc_connection *msc_conn_by_imsi(struct bsc_nat *nat, const char *imsi) { struct msc_config *conf; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index 3f20a0cb8..dcf83f397 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -826,6 +826,14 @@ DEFUN(cfg_nat_use_ipa_for_mgcp, return CMD_SUCCESS; } +DEFUN(cfg_nat_default_msc, + cfg_nat_default_msc_cmd, + "default msc NR", + "The MSC to route messages to by default\n" "MSC number\n") +{ + _nat->default_msc = atoi(argv[0]); +} + DEFUN(cfg_nat_sdp_amr_mode_set, cfg_nat_sdp_amr_mode_set_cmd, "sdp-ensure-amr-mode-set", @@ -1350,6 +1358,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat) install_element(NAT_NODE, &cfg_nat_ussd_token_cmd); install_element(NAT_NODE, &cfg_nat_ussd_local_cmd); install_element(NAT_NODE, &cfg_nat_use_ipa_for_mgcp_cmd); + install_element(NAT_NODE, &cfg_nat_default_msc_cmd); bsc_msg_lst_vty_init(nat, &nat->access_lists, NAT_NODE); |