lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

February 2024

  • 1 participants
  • 1748 discussions
[S] Change in osmo-msc[master]: pick up all *.vty in EXTRA_DIST
by neels 08 Feb '24

08 Feb '24
Attention is currently required from: fixeria, laforge, pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35872?usp=email ) Change subject: pick up all *.vty in EXTRA_DIST ...................................................................... Patch Set 1: (1 comment) Patchset: PS1: > That rings a bell for me too. I observe that: - all *.vty files are present in the distro tar on https://obs.osmocom.org/package/show/osmocom:master/osmo-bsc - but also neighbor_ident.vty is present in https://obs.osmocom.org/package/show/osmocom:master/osmo-msc even though it is missing from Makefile.am's EXTRA_DIST That confuses me. When I do 'make dist' in osmo-msc, neighbor_ident.vty is missing from the distro tar. Aren't the packages in OBS built from 'make dist'?????? For the record, 'make dist' in osmo-bsc includes all *.vty files as expected, so the wildcard Works For Me (TM)... I know about all those aspects of wildcards in build files, yet in practice I find that: anything without a wildcard will have us forget to add *.vty files to Makefile.am, and using the wildcard means we will never forget them again... Let's clarify first why non-make-dist files show up in OBS. -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35872?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Id28e020fc59b83d1b4cd0e5b72314a46bea62259 Gerrit-Change-Number: 35872 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 08 Feb 2024 22:51:50 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: ctrl: Add ms power
by laforge 08 Feb '24

08 Feb '24
Attention is currently required from: daniel, fixeria, fixeria, matanp, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35747?usp=email ) Change subject: ctrl: Add ms power ...................................................................... Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35747?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I6f556b66011be6126d6bac31a14101ba37f81cc4 Gerrit-Change-Number: 35747 Gerrit-PatchSet: 6 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <axilirator(a)gmail.com> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: fixeria <axilirator(a)gmail.com> Gerrit-Attention: matanp <matan1008(a)gmail.com> Gerrit-Comment-Date: Thu, 08 Feb 2024 20:31:02 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: ctrl: Split bts_trx_ts_ctrl from bts_trx_ctrl
by matanp 08 Feb '24

08 Feb '24
matanp has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35746?usp=email ) Change subject: ctrl: Split bts_trx_ts_ctrl from bts_trx_ctrl ...................................................................... ctrl: Split bts_trx_ts_ctrl from bts_trx_ctrl Besides from making the ts ctrl interface follow the convention of being in its own file, it will be used in the next patch to add a ctrl interface for lchan. Change-Id: I9840bddd4eae409bc8373912d54b6bbfc9fc1c1a --- M include/osmocom/bsc/ctrl.h M src/osmo-bsc/Makefile.am M src/osmo-bsc/bts_trx_ctrl.c A src/osmo-bsc/bts_trx_ts_ctrl.c 4 files changed, 121 insertions(+), 98 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve matanp: Looks good to me, approved laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/ctrl.h b/include/osmocom/bsc/ctrl.h index 86d1bda..0d6c8a0 100644 --- a/include/osmocom/bsc/ctrl.h +++ b/include/osmocom/bsc/ctrl.h @@ -11,6 +11,7 @@ /* Used internally in different ctrl source code files: */ int bsc_bts_ctrl_cmds_install(void); int bsc_bts_trx_ctrl_cmds_install(void); +int bsc_bts_trx_ts_ctrl_cmds_install(void); void ctrl_generate_bts_location_state_trap(struct gsm_bts *bts, struct bsc_msc_data *msc); void osmo_bsc_send_trap(struct ctrl_cmd *cmd, struct bsc_msc_data *msc_data); diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am index 661188e..e577c95 100644 --- a/src/osmo-bsc/Makefile.am +++ b/src/osmo-bsc/Makefile.am @@ -46,6 +46,7 @@ bts.c \ bts_trx.c \ bts_trx_ctrl.c \ + bts_trx_ts_ctrl.c \ bts_ericsson_rbs2000.c \ bts_init.c \ bts_ipaccess_nanobts.c \ diff --git a/src/osmo-bsc/bts_trx_ctrl.c b/src/osmo-bsc/bts_trx_ctrl.c index 258203c..d5e8f5a 100644 --- a/src/osmo-bsc/bts_trx_ctrl.c +++ b/src/osmo-bsc/bts_trx_ctrl.c @@ -19,109 +19,11 @@ * */ -#include <errno.h> -#include <time.h> - #include <osmocom/ctrl/control_cmd.h> #include <osmocom/bsc/ctrl.h> -#include <osmocom/bsc/osmo_bsc_rf.h> #include <osmocom/bsc/bts.h> -#include <osmocom/bsc/ipaccess.h> -#include <osmocom/bsc/chan_alloc.h> #include <osmocom/bsc/abis_nm.h> -#include <osmocom/bsc/neighbor_ident.h> -#include <osmocom/bsc/system_information.h> - -/********************* - * TS_NODE - *********************/ - -static int verify_ts_hopping_arfcn_add(struct ctrl_cmd *cmd, const char *value, void *_data) -{ - int64_t arfcn; - enum gsm_band unused; - if (osmo_str_to_int64(&arfcn, value, 10, 0, 1024) < 0) - return 1; - if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { - return 1; - } - return 0; -} -static int set_ts_hopping_arfcn_add(struct ctrl_cmd *cmd, void *data) -{ - struct gsm_bts_trx_ts *ts = cmd->node; - int arfcn = atoi(cmd->value); - - bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ONE); - - /* Update Cell Allocation (list of all the frequencies allocated to a cell) */ - if (generate_cell_chan_alloc(ts->trx->bts) != 0) { - bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); /* roll-back */ - cmd->reply = "Failed to re-generate Cell Allocation"; - return CTRL_CMD_ERROR; - } - - cmd->reply = "OK"; - return CTRL_CMD_REPLY; -} -/* Parameter format: "<arfcn>" */ -CTRL_CMD_DEFINE_WO(ts_hopping_arfcn_add, "hopping-arfcn-add"); - -static int verify_ts_hopping_arfcn_del(struct ctrl_cmd *cmd, const char *value, void *_data) -{ - int64_t arfcn; - enum gsm_band unused; - if (strcmp(value, "all") == 0) - return 0; - if (osmo_str_to_int64(&arfcn, value, 10, 0, 1024) < 0) - return 1; - if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { - return 1; - } - return 0; -} -static int set_ts_hopping_arfcn_del(struct ctrl_cmd *cmd, void *data) -{ - struct gsm_bts_trx_ts *ts = cmd->node; - bool all = (strcmp(cmd->value, "all") == 0); - int arfcn; - - if (all) { - bitvec_zero(&ts->hopping.arfcns); - } else { - arfcn = atoi(cmd->value); - bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); - } - - /* Update Cell Allocation (list of all the frequencies allocated to a cell) */ - if (generate_cell_chan_alloc(ts->trx->bts) != 0) { - if (!all) - bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ONE); /* roll-back */ - cmd->reply = "Failed to re-generate Cell Allocation"; - return CTRL_CMD_ERROR; - } - - cmd->reply = "OK"; - return CTRL_CMD_REPLY; -} -/* Parameter format: "(<arfcn>|all)" */ -CTRL_CMD_DEFINE_WO(ts_hopping_arfcn_del, "hopping-arfcn-del"); - - -static int bsc_bts_trx_ts_ctrl_cmds_install(void) -{ - int rc = 0; - - rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_add); - rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_del); - - return rc; -} - -/********************* - * TRX_NODE - *********************/ static int get_trx_rf_locked(struct ctrl_cmd *cmd, void *data) { diff --git a/src/osmo-bsc/bts_trx_ts_ctrl.c b/src/osmo-bsc/bts_trx_ts_ctrl.c new file mode 100644 index 0000000..dc8aaf4 --- /dev/null +++ b/src/osmo-bsc/bts_trx_ts_ctrl.c @@ -0,0 +1,106 @@ +/* + * (C) 2013-2015 by Holger Hans Peter Freyther + * (C) 2013-2022 by sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/ctrl/control_cmd.h> + +#include <osmocom/bsc/ctrl.h> +#include <osmocom/bsc/bts.h> +#include <osmocom/bsc/system_information.h> + +static int verify_ts_hopping_arfcn_add(struct ctrl_cmd *cmd, const char *value, void *_data) +{ + int64_t arfcn; + enum gsm_band unused; + if (osmo_str_to_int64(&arfcn, value, 10, 0, 1024) < 0) + return 1; + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) + return 1; + return 0; +} +static int set_ts_hopping_arfcn_add(struct ctrl_cmd *cmd, void *data) +{ + struct gsm_bts_trx_ts *ts = cmd->node; + int arfcn = atoi(cmd->value); + + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ONE); + + /* Update Cell Allocation (list of all the frequencies allocated to a cell) */ + if (generate_cell_chan_alloc(ts->trx->bts) != 0) { + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); /* roll-back */ + cmd->reply = "Failed to re-generate Cell Allocation"; + return CTRL_CMD_ERROR; + } + + cmd->reply = "OK"; + return CTRL_CMD_REPLY; +} +/* Parameter format: "<arfcn>" */ +CTRL_CMD_DEFINE_WO(ts_hopping_arfcn_add, "hopping-arfcn-add"); + +static int verify_ts_hopping_arfcn_del(struct ctrl_cmd *cmd, const char *value, void *_data) +{ + int64_t arfcn; + enum gsm_band unused; + if (strcmp(value, "all") == 0) + return 0; + if (osmo_str_to_int64(&arfcn, value, 10, 0, 1024) < 0) + return 1; + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) + return 1; + return 0; +} +static int set_ts_hopping_arfcn_del(struct ctrl_cmd *cmd, void *data) +{ + struct gsm_bts_trx_ts *ts = cmd->node; + bool all = (strcmp(cmd->value, "all") == 0); + int arfcn; + + if (all) { + bitvec_zero(&ts->hopping.arfcns); + } else { + arfcn = atoi(cmd->value); + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); + } + + /* Update Cell Allocation (list of all the frequencies allocated to a cell) */ + if (generate_cell_chan_alloc(ts->trx->bts) != 0) { + if (!all) + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ONE); /* roll-back */ + cmd->reply = "Failed to re-generate Cell Allocation"; + return CTRL_CMD_ERROR; + } + + cmd->reply = "OK"; + return CTRL_CMD_REPLY; +} +/* Parameter format: "(<arfcn>|all)" */ +CTRL_CMD_DEFINE_WO(ts_hopping_arfcn_del, "hopping-arfcn-del"); + + +int bsc_bts_trx_ts_ctrl_cmds_install(void) +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_add); + rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_del); + + return rc; +} -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35746?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I9840bddd4eae409bc8373912d54b6bbfc9fc1c1a Gerrit-Change-Number: 35746 Gerrit-PatchSet: 4 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: ctrl: Split bts_trx_ts_ctrl from bts_trx_ctrl
by laforge 08 Feb '24

08 Feb '24
Attention is currently required from: matanp. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35746?usp=email ) Change subject: ctrl: Split bts_trx_ts_ctrl from bts_trx_ctrl ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35746?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I9840bddd4eae409bc8373912d54b6bbfc9fc1c1a Gerrit-Change-Number: 35746 Gerrit-PatchSet: 3 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: matanp <matan1008(a)gmail.com> Gerrit-Comment-Date: Thu, 08 Feb 2024 20:30:03 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: epdg: Add PDP-Info IE to GSUP Auth Info Req
by lynxis lazus 08 Feb '24

08 Feb '24
Attention is currently required from: fixeria, laforge, pespin. lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35900?usp=email ) Change subject: epdg: Add PDP-Info IE to GSUP Auth Info Req ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35900?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I42e4dc4bbcef969aae5867dbb103f8a5db157c89 Gerrit-Change-Number: 35900 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 08 Feb 2024 20:12:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-epdg[master]: Add defines for PDP Address Type Nr
by pespin 08 Feb '24

08 Feb '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35903?usp=email ) Change subject: Add defines for PDP Address Type Nr ...................................................................... Add defines for PDP Address Type Nr The values are the same for GTP and GMM (which in turn are used by GSUP). Change-Id: I48e7064f598d6dfb0d4398500fb078b2d5da0226 --- M include/gtp_utils.hrl M src/aaa_diameter_swx.erl M src/gsup_server.erl 3 files changed, 25 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/gtp_utils.hrl b/include/gtp_utils.hrl index 453efb0..4d1efe2 100644 --- a/include/gtp_utils.hrl +++ b/include/gtp_utils.hrl @@ -110,4 +110,8 @@ -define(GTP2_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED, 126). -define(GTP2_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY, 127). -define(GTP2_CAUSE_S1_U_PATH_FAILURE, 128). --define(GTP2_CAUSE_5GC_NOT_ALLOWED, 129). \ No newline at end of file +-define(GTP2_CAUSE_5GC_NOT_ALLOWED, 129). + +-define(GTP_PDP_ADDR_TYPE_NR_IPv4, 16#21). +-define(GTP_PDP_ADDR_TYPE_NR_IPv6, 16#57). +-define(GTP_PDP_ADDR_TYPE_NR_IPv4v6, 16#8d). \ No newline at end of file diff --git a/src/aaa_diameter_swx.erl b/src/aaa_diameter_swx.erl index e3ca289..c623b3e 100644 --- a/src/aaa_diameter_swx.erl +++ b/src/aaa_diameter_swx.erl @@ -42,6 +42,7 @@ -include_lib("diameter_3gpp_ts29_273_swx.hrl"). -include_lib("diameter/include/diameter_gen_base_rfc6733.hrl"). +-include("gtp_utils.hrl"). %% API Function Exports -export([start_link/0]). @@ -191,13 +192,13 @@ % Set only the Reserved=0 byte and Prefix-Length=0 IPv6Dyn = <<16#00:8,16#00:8>>, case PdpTypeNr of - 16#21 -> + ?GTP_PDP_ADDR_TYPE_NR_IPv4 -> IPv4Opt = Ipv4Dyn, IPv6Opt = []; - 16#57 -> + ?GTP_PDP_ADDR_TYPE_NR_IPv6 -> IPv4Opt = [], IPv6Opt = IPv6Dyn; - 16#8d -> + ?GTP_PDP_ADDR_TYPE_NR_IPv4v6 -> IPv4Opt = Ipv4Dyn, IPv6Opt = IPv6Dyn; _ -> diff --git a/src/gsup_server.erl b/src/gsup_server.erl index 799d6df..229f5db 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -40,6 +40,7 @@ -include_lib("osmo_ss7/include/ipa.hrl"). -include_lib("osmo_gsup/include/gsup_protocol.hrl"). -include_lib("gtplib/include/gtp_packet.hrl"). +-include("gtp_utils.hrl"). -define(SERVER, ?MODULE). @@ -160,7 +161,9 @@ IEs = CreateSessResp#gtp.ie, %%#{{v2_bearer_context,0} := BearerMap} = IEs, #{{v2_pdn_address_allocation,0} := Paa} = IEs, - PdpAddress = #{pdp_type_org => 1, pdp_type_nr => 16#21, address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, + PdpAddress = #{pdp_type_org => 1, + pdp_type_nr => ?GTP_PDP_ADDR_TYPE_NR_IPv4, + address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, PdpInfo = #{pdp_context_id => 0, pdp_address => PdpAddress, access_point_name => "foobar.apn", -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35903?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I48e7064f598d6dfb0d4398500fb078b2d5da0226 Gerrit-Change-Number: 35903 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in ...osmo-epdg[master]: Make PDP-Type and APN from GSUP AuthInfoReq available through all layers
by pespin 08 Feb '24

08 Feb '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35901?usp=email ) Change subject: Make PDP-Type and APN from GSUP AuthInfoReq available through all layers ...................................................................... Make PDP-Type and APN from GSUP AuthInfoReq available through all layers Change-Id: I3f29b00f57f433f8623b9f0a5048c83985e5cced --- M src/aaa_diameter_swm.erl M src/aaa_diameter_swx.erl M src/aaa_ue_fsm.erl M src/epdg_diameter_swm.erl M src/epdg_ue_fsm.erl M src/gsup_server.erl 6 files changed, 75 insertions(+), 30 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/aaa_diameter_swm.erl b/src/aaa_diameter_swm.erl index ee3a8cb..7fdc247 100644 --- a/src/aaa_diameter_swm.erl +++ b/src/aaa_diameter_swm.erl @@ -20,7 +20,7 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -export([code_change/3, terminate/2]). --export([auth_request/1, auth_compl_request/2, session_termination_request/1]). +-export([auth_request/3, auth_compl_request/2, session_termination_request/1]). -export([auth_response/2, auth_compl_response/2, session_termination_answer/2]). -define(SERVER, ?MODULE). @@ -47,8 +47,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Rx from emulated SWm wire: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -auth_request(Imsi) -> - gen_server:cast(?SERVER, {epdg_auth_req, Imsi}). +auth_request(Imsi, PdpTypeNr, Apn) -> + gen_server:cast(?SERVER, {epdg_auth_req, Imsi, PdpTypeNr, Apn}). auth_compl_request(Imsi, Apn) -> gen_server:cast(?SERVER, {epdg_auth_compl_req, Imsi, Apn}). @@ -56,9 +56,9 @@ session_termination_request(Imsi) -> gen_server:cast(?SERVER, {str, Imsi}). -handle_cast({epdg_auth_req, Imsi}, State0) -> +handle_cast({epdg_auth_req, Imsi, PdpTypeNr, Apn}, State0) -> {Sess, State1} = find_or_new_swm_session(Imsi, State0), - aaa_ue_fsm:ev_swm_auth_req(Sess#swm_session.pid), + aaa_ue_fsm:ev_swm_auth_req(Sess#swm_session.pid, {PdpTypeNr, Apn}), {noreply, State1}; handle_cast({epdg_auth_compl_req, Imsi, Apn}, State) -> diff --git a/src/aaa_diameter_swx.erl b/src/aaa_diameter_swx.erl index 1db5809..e3ca289 100644 --- a/src/aaa_diameter_swx.erl +++ b/src/aaa_diameter_swx.erl @@ -49,7 +49,7 @@ %% gen_server Function Exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -export([code_change/3]). --export([multimedia_auth_request/6]). +-export([multimedia_auth_request/7]). -export([server_assignment_request/3]). -export([test/0, test/1]). @@ -136,11 +136,11 @@ test("001011234567890"). test(IMSI) -> - multimedia_auth_request(IMSI, 3, "EAP-AKA", 1, [], []). + multimedia_auth_request(IMSI, 3, "EAP-AKA", 1, [], [], 33). -multimedia_auth_request(IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey) -> +multimedia_auth_request(IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey, PdpTypeNr) -> gen_server:call(?SERVER, - {mar, {IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey}}). + {mar, {IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey, PdpTypeNr}}). % APN is optional and should be [] server_assignment_request(IMSI, Type, APN) -> gen_server:call(?SERVER, @@ -181,8 +181,30 @@ parse_saa(Saa) -> {unknown_err, []}. -handle_call({mar, {IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey}}, {Pid, _Tag} = _From, State) -> +handle_call({mar, {IMSI, NumAuthItems, AuthScheme, RAT, CKey, IntegrityKey, PdpTypeNr}}, {Pid, _Tag} = _From, State) -> SessionId = diameter:session_id(application:get_env(?ENV_APP_NAME, origin_host, ?ENV_DEFAULT_ORIG_HOST)), + % RFC 4005 6.11.1 Framed-IP-Address AVP: + % "0xFFFFFFFE indicates that the NAS should select an address for the user + % (e.g., assigned from a pool of addresses kept by the NAS)." + Ipv4Dyn = <<16#FFFFFFFE:32>>, + % 3GPP TS 29.229 6.3.54, RFC4005 6.11.6 2.3, RFC3162 2.3 allow empty prefix. + % Set only the Reserved=0 byte and Prefix-Length=0 + IPv6Dyn = <<16#00:8,16#00:8>>, + case PdpTypeNr of + 16#21 -> + IPv4Opt = Ipv4Dyn, + IPv6Opt = []; + 16#57 -> + IPv4Opt = [], + IPv6Opt = IPv6Dyn; + 16#8d -> + IPv4Opt = Ipv4Dyn, + IPv6Opt = IPv6Dyn; + _ -> + IPv4Opt = [], + IPv6Opt = [] + end, + lager:debug("Swx MAR: IPv4Opt=~p IPv6Opt=~p~n", [IPv4Opt, IPv6Opt]), MAR = #'MAR'{'Vendor-Specific-Application-Id' = #'Vendor-Specific-Application-Id'{ 'Vendor-Id' = ?VENDOR_ID_3GPP, 'Auth-Application-Id' = [?DIAMETER_APP_ID_SWX]}, @@ -192,10 +214,14 @@ 'SIP-Auth-Data-Item' = #'SIP-Auth-Data-Item'{ 'SIP-Authentication-Scheme' = [AuthScheme], 'Confidentiality-Key' = CKey, - 'Integrity-Key' = IntegrityKey}, + 'Integrity-Key' = IntegrityKey, + 'Framed-IP-Address' = IPv4Opt, + 'Framed-IPv6-Prefix' = IPv6Opt + }, 'SIP-Number-Auth-Items' = NumAuthItems, 'RAT-Type' = RAT }, + lager:debug("Swx Tx MAR: ~p~n", [MAR]), Ret = diameter:call(?SVC_NAME, ?APP_ALIAS, MAR, [{extra, [Pid]}, detach]), case Ret of ok -> diff --git a/src/aaa_ue_fsm.erl b/src/aaa_ue_fsm.erl index 5cdb553..e982d57 100644 --- a/src/aaa_ue_fsm.erl +++ b/src/aaa_ue_fsm.erl @@ -41,7 +41,7 @@ -export([start_link/1]). -export([init/1,callback_mode/0,terminate/3]). -export([get_server_name_by_imsi/1, get_pid_by_imsi/1]). --export([ev_swm_auth_req/1, ev_swm_auth_compl/2, ev_rx_swm_str/1, ev_rx_swx_maa/2, ev_rx_swx_saa/2, +-export([ev_swm_auth_req/2, ev_swm_auth_compl/2, ev_rx_swm_str/1, ev_rx_swx_maa/2, ev_rx_swx_saa/2, ev_rx_s6b_aar/2, ev_rx_s6b_str/1]). -export([state_new/3, state_wait_swx_maa/3, state_wait_swx_saa/3, state_authenticated/3, state_authenticated_wait_swx_saa/3]). @@ -66,10 +66,10 @@ lager:info("ue_fsm start_link(~p)~n", [ServerName]), gen_statem:start_link({local, ServerName}, ?MODULE, Imsi, [{debug, [trace]}]). -ev_swm_auth_req(Pid) -> +ev_swm_auth_req(Pid, {PdpTypeNr, Apn}) -> lager:info("ue_fsm ev_swm_auth_req~n", []), try - gen_statem:call(Pid, swm_auth_req) + gen_statem:call(Pid, {swm_auth_req, PdpTypeNr, Apn}) catch exit:Err -> {error, Err} @@ -152,12 +152,12 @@ state_new(enter, _OldState, Data) -> {keep_state, Data}; -state_new({call, From}, swm_auth_req, Data) -> - lager:info("ue_fsm state_new event=swm_auth_req, ~p~n", [Data]), +state_new({call, From}, {swm_auth_req, PdpTypeNr, Apn}, Data) -> + lager:info("ue_fsm state_new event=swm_auth_req {~p, ~p}, ~p~n", [PdpTypeNr, Apn, Data]), % request the diameter code for a tuple CKey = [], IntegrityKey = [], - case aaa_diameter_swx:multimedia_auth_request(Data#ue_fsm_data.imsi, 1, "EAP-AKA", 1, CKey, IntegrityKey) of + case aaa_diameter_swx:multimedia_auth_request(Data#ue_fsm_data.imsi, 1, "EAP-AKA", 1, CKey, IntegrityKey, PdpTypeNr) of ok -> {next_state, state_wait_swx_maa, Data, [{reply,From,ok}]}; {error, Err} -> {keep_state, Data, [{reply,From,{error, Err}}]} end; diff --git a/src/epdg_diameter_swm.erl b/src/epdg_diameter_swm.erl index 800df44..9b010d9 100644 --- a/src/epdg_diameter_swm.erl +++ b/src/epdg_diameter_swm.erl @@ -19,7 +19,7 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -export([code_change/3, terminate/2]). --export([auth_request/1, auth_compl_request/2, session_termination_request/1]). +-export([auth_request/3, auth_compl_request/2, session_termination_request/1]). -export([auth_response/2, auth_compl_response/2, session_termination_answer/2]). -define(SERVER, ?MODULE). @@ -33,10 +33,13 @@ {ok, #swm_state{}}. -auth_request(Imsi) -> +auth_request(Imsi, PdpTypeNr, Apn) -> % In Diameter we use Imsi as strings, as done by diameter module. ImsiStr = binary_to_list(Imsi), - Result = gen_server:call(?SERVER, {epdg_auth_req, ImsiStr}), + % epdg_auth_req: Swm Diameter message Diameter-EAP-Request 3GPP TS 29.273 7.2.2.1.1 + % PdpTypeNr: SWm Diameter AVP "UE-Local-IP-Address" + % Apn: SWm Diameter AVP "Service-Selection" + Result = gen_server:call(?SERVER, {epdg_auth_req, ImsiStr, PdpTypeNr, Apn}), case Result of {ok, _Mar} -> epdg_ue_fsm:received_swm_auth_response(self(), Result), @@ -68,10 +71,10 @@ _ -> Result end. -handle_call({epdg_auth_req, Imsi}, {Pid, _Tag} = _From, State0) -> +handle_call({epdg_auth_req, Imsi, PdpTypeNr, Apn}, {Pid, _Tag} = _From, State0) -> % we yet don't implement the Diameter SWm interface on the wire, we process the call internally: {_Sess, State1} = find_or_new_swm_session(Imsi, Pid, State0), - ok = aaa_diameter_swm:auth_request(Imsi), + ok = aaa_diameter_swm:auth_request(Imsi, PdpTypeNr, Apn), {reply, ok, State1}; handle_call({epdg_auth_compl_req, Imsi, Apn}, _From, State) -> diff --git a/src/epdg_ue_fsm.erl b/src/epdg_ue_fsm.erl index 711f695..9221c79 100644 --- a/src/epdg_ue_fsm.erl +++ b/src/epdg_ue_fsm.erl @@ -40,7 +40,7 @@ -export([start_link/1, stop/1]). -export([init/1,callback_mode/0,terminate/3]). -export([get_server_name_by_imsi/1, get_pid_by_imsi/1]). --export([auth_request/1, lu_request/1, tunnel_request/1, purge_ms_request/1]). +-export([auth_request/2, lu_request/1, tunnel_request/1, purge_ms_request/1]). -export([received_swm_auth_response/2, received_swm_auth_compl_response/2, received_swm_session_termination_answer/2]). -export([received_gtpc_create_session_response/2, received_gtpc_delete_session_response/2, received_gtpc_delete_bearer_request/1]). -export([state_new/3, state_wait_auth_resp/3, state_authenticating/3, state_authenticated/3, @@ -69,10 +69,10 @@ stop(SrvRef) -> gen_statem:stop(SrvRef). -auth_request(Pid) -> +auth_request(Pid, {PdpTypeNr, Apn}) -> lager:info("ue_fsm auth_request~n", []), try - gen_statem:call(Pid, auth_request) + gen_statem:call(Pid, {auth_request, PdpTypeNr, Apn}) catch exit:Err -> {error, Err} @@ -183,9 +183,9 @@ state_new(enter, _OldState, Data) -> {keep_state, Data}; -state_new({call, From}, auth_request, Data) -> - lager:info("ue_fsm state_new event=auth_request, ~p~n", [Data]), - case epdg_diameter_swm:auth_request(Data#ue_fsm_data.imsi) of +state_new({call, From}, {auth_request, PdpTypeNr, Apn}, Data) -> + lager:info("ue_fsm state_new event=auth_request {~p, ~p}, ~p~n", [PdpTypeNr, Apn, Data]), + case epdg_diameter_swm:auth_request(Data#ue_fsm_data.imsi, PdpTypeNr, Apn) of ok -> {next_state, state_wait_auth_resp, Data, [{reply,From,ok}]}; {error, Err} -> {stop_and_reply, Err, Data, [{reply,From,{error,Err}}]} end; diff --git a/src/gsup_server.erl b/src/gsup_server.erl index 8a070bf..799d6df 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -231,9 +231,16 @@ {noreply, S#gsups_state{socket=Socket}}; % send auth info / requesting authentication tuples -handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, _GsupMsgRx = #{message_type := send_auth_info_req, imsi := Imsi}}, State0) -> +handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, GsupMsgRx = #{message_type := send_auth_info_req, imsi := Imsi}}, State0) -> + #{pdp_info_list := [PdpInfo]} = GsupMsgRx, + #{pdp_context_id := _PDPCtxId, + pdp_address := #{address := #{}, + pdp_type_nr := PdpTypeNr, + pdp_type_org := 241}, + access_point_name := Apn + } = PdpInfo, {UE, State1} = find_or_new_gsups_ue(Imsi, State0), - case epdg_ue_fsm:auth_request(UE#gsups_ue.pid) of + case epdg_ue_fsm:auth_request(UE#gsups_ue.pid, {PdpTypeNr, Apn}) of ok -> State2 = State1; {error, Err} -> lager:error("Auth Req for Imsi ~p failed: ~p~n", [Imsi, Err]), -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35901?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I3f29b00f57f433f8623b9f0a5048c83985e5cced Gerrit-Change-Number: 35901 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in ...osmo-epdg[master]: Keep gtp2c specificities in its module file
by pespin 08 Feb '24

08 Feb '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35904?usp=email ) Change subject: Keep gtp2c specificities in its module file ...................................................................... Keep gtp2c specificities in its module file Change-Id: I03cfe86723e881013a3a745eb81f6d0d8b9cfe94 --- A include/conv.hrl M src/conv.erl M src/epdg_gtpc_s2b.erl M src/epdg_ue_fsm.erl M src/gsup_server.erl 5 files changed, 83 insertions(+), 15 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/conv.hrl b/include/conv.hrl new file mode 100644 index 0000000..1284d3b --- /dev/null +++ b/include/conv.hrl @@ -0,0 +1,39 @@ +% (C) 2023 by sysmocom +% +% All Rights Reserved +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU Affero General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU Affero General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +% Additional Permission under GNU AGPL version 3 section 7: +% +% If you modify this Program, or any covered work, by linking or +% combining it with runtime libraries of Erlang/OTP as released by +% Ericsson on http://www.erlang.org (or a modified version of these +% libraries), containing parts covered by the terms of the Erlang Public +% License (http://www.erlang.org/EPLICENSE) the licensors of this +% Program grant you additional permission to convey the resulting work +% without the need to license the runtime libraries of Erlang/OTP under +% the GNU Affero General Public License. Corresponding Source for a +% non-source form of such a combination shall include the source code +% for the parts of the runtime libraries of Erlang/OTP used as well as +% that of the covered work. +% +-hrl_name('conv.hrl'). + +-record(epdg_eua, { + type_nr :: non_neg_integer(), + ipv4 :: binary(), + ipv6 :: binary() +}). + diff --git a/src/conv.erl b/src/conv.erl index 30365cc..a041847 100644 --- a/src/conv.erl +++ b/src/conv.erl @@ -34,9 +34,11 @@ -author('Pau Espin Pedrol <pespin(a)sysmocom.de>'). -include_lib("osmo_gsup/include/gsup_protocol.hrl"). +-include_lib("gtplib/include/gtp_packet.hrl"). -include_lib("gtp_utils.hrl"). +-include_lib("conv.hrl"). --export([cause_gtp2gsup/1]). +-export([cause_gtp2gsup/1, gtp2_paa_to_epdg_eua/1, epdg_eua_to_gsup_pdp_address/1]). -spec cause_gtp2gsup(integer()) -> integer(). @@ -51,3 +53,23 @@ cause_gtp2gsup(?GTP2_CAUSE_MANDATORY_IE_INCORRECT) -> ?GSUP_CAUSE_INV_MAND_INFO; cause_gtp2gsup(?GTP2_CAUSE_MANDATORY_IE_MISSING) -> ?GSUP_CAUSE_INV_MAND_INFO; cause_gtp2gsup(_) -> ?GSUP_CAUSE_PROTO_ERR_UNSPEC. + + +gtp2_paa_to_epdg_eua(#v2_pdn_address_allocation{type = ipv4, address = Addr}) -> + #epdg_eua{type_nr = ?GTP_PDP_ADDR_TYPE_NR_IPv4, + ipv4 = Addr}; +gtp2_paa_to_epdg_eua(#v2_pdn_address_allocation{type = ipv6, address = Addr}) -> + #epdg_eua{type_nr = ?GTP_PDP_ADDR_TYPE_NR_IPv6, + ipv6 = Addr}. +%TODO: IPv4v6 + +epdg_eua_to_gsup_pdp_address(#epdg_eua{type_nr = ?GTP_PDP_ADDR_TYPE_NR_IPv4, ipv4 = Addr}) -> + #{pdp_type_org => 1, + pdp_type_nr => ?GTP_PDP_ADDR_TYPE_NR_IPv4, + address => #{ ipv4 => Addr}}; + +epdg_eua_to_gsup_pdp_address(#epdg_eua{type_nr = ?GTP_PDP_ADDR_TYPE_NR_IPv6, ipv6 = Addr}) -> +#{pdp_type_org => 1, + pdp_type_nr => ?GTP_PDP_ADDR_TYPE_NR_IPv6, + address => #{ ipv6 => Addr}}. +%TODO: IPv4v6 diff --git a/src/epdg_gtpc_s2b.erl b/src/epdg_gtpc_s2b.erl index 0b76b6f..9acbefa 100644 --- a/src/epdg_gtpc_s2b.erl +++ b/src/epdg_gtpc_s2b.erl @@ -316,7 +316,12 @@ Sess1 = update_gtp_session_from_create_session_response(Resp, Sess0), lager:info("s2b: Updated Session after create_session_response: ~p~n", [Sess1]), State1 = update_gtp_session(Sess0, Sess1, State0), - epdg_ue_fsm:received_gtpc_create_session_response(Sess0#gtp_session.pid, {ok, Resp}), + % Do GTP specific msg parsing here, pass only relevant fields: + #{{v2_pdn_address_allocation,0} := Paa} = Resp#gtp.ie, + ResInfo = #{ + eua => conv:gtp2_paa_to_epdg_eua(Paa) + }, + epdg_ue_fsm:received_gtpc_create_session_response(Sess0#gtp_session.pid, {ok, ResInfo}), {noreply, State1} end; diff --git a/src/epdg_ue_fsm.erl b/src/epdg_ue_fsm.erl index 9221c79..fa780e8 100644 --- a/src/epdg_ue_fsm.erl +++ b/src/epdg_ue_fsm.erl @@ -132,10 +132,10 @@ {error, Err} end. -received_gtpc_create_session_response(Pid, Msg) -> - lager:info("ue_fsm received_gtpc_create_session_response ~p~n", [Msg]), +received_gtpc_create_session_response(Pid, Result) -> + lager:info("ue_fsm received_gtpc_create_session_response ~p~n", [Result]), try - gen_statem:call(Pid, {received_gtpc_create_session_response, Msg}) + gen_statem:call(Pid, {received_gtpc_create_session_response, Result}) catch exit:Err -> {error, Err} diff --git a/src/gsup_server.erl b/src/gsup_server.erl index 229f5db..065abb4 100644 --- a/src/gsup_server.erl +++ b/src/gsup_server.erl @@ -39,8 +39,8 @@ -include_lib("diameter_3gpp_ts29_273_swx.hrl"). -include_lib("osmo_ss7/include/ipa.hrl"). -include_lib("osmo_gsup/include/gsup_protocol.hrl"). --include_lib("gtplib/include/gtp_packet.hrl"). -include("gtp_utils.hrl"). +-include("conv.hrl"). -define(SERVER, ?MODULE). @@ -156,16 +156,9 @@ lager:info("tunnel_response for ~p: ~p~n", [Imsi, Result]), Socket = State#gsups_state.socket, case Result of - {ok, #gtp{version = v2, type = create_session_response}} -> - {ok, CreateSessResp} = Result, - IEs = CreateSessResp#gtp.ie, - %%#{{v2_bearer_context,0} := BearerMap} = IEs, - #{{v2_pdn_address_allocation,0} := Paa} = IEs, - PdpAddress = #{pdp_type_org => 1, - pdp_type_nr => ?GTP_PDP_ADDR_TYPE_NR_IPv4, - address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}}, + {ok, #{eua := Eua}} -> PdpInfo = #{pdp_context_id => 0, - pdp_address => PdpAddress, + pdp_address => conv:epdg_eua_to_gsup_pdp_address(Eua), access_point_name => "foobar.apn", quality_of_service => <<0, 0, 0>>, pdp_charging => 0}, -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35904?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I03cfe86723e881013a3a745eb81f6d0d8b9cfe94 Gerrit-Change-Number: 35904 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in ...osmo-epdg[master]: config: Drop unused sasl section
by pespin 08 Feb '24

08 Feb '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35907?usp=email ) Change subject: config: Drop unused sasl section ...................................................................... config: Drop unused sasl section Change-Id: Ie75c43fb92f4d1d9756943cf4432d32428d2fe8f --- M config/sys.config 1 file changed, 9 insertions(+), 11 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/config/sys.config b/config/sys.config index 3f9d607..905b8a1 100755 --- a/config/sys.config +++ b/config/sys.config @@ -38,17 +38,6 @@ {gtpc_remote_port, 2123} ]}, %% =========================================== - %% SASL config - %% =========================================== - {sasl, [{sasl_error_logger, false}]}, - % {sasl, [ - % {sasl_error_logger, {file, "log/sasl-error.log"}}, - % {errlog_type, error}, - % {error_logger_mf_dir, "log/sasl"}, % Log directory - % {error_logger_mf_maxbytes, 10485760}, % 10 MB max file size - % {error_logger_mf_maxfiles, 5} % 5 files max - % ]}, - % %% =========================================== %% Lager logging config %% =========================================== {lager, [ -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35907?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: Ie75c43fb92f4d1d9756943cf4432d32428d2fe8f Gerrit-Change-Number: 35907 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in ...osmo-epdg[master]: Create PDP Context in tunnel after rx S6b CreateSessionResp
by pespin 08 Feb '24

08 Feb '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35906?usp=email ) Change subject: Create PDP Context in tunnel after rx S6b CreateSessionResp ...................................................................... Create PDP Context in tunnel after rx S6b CreateSessionResp This refactoring is a preparation to call the gtp_u_kmod APIs. Change-Id: I911985743af6b3fa90fd78631a562b85ecacce15 --- M src/conv.erl M src/epdg_gtpc_s2b.erl M src/epdg_ue_fsm.erl A src/gtp_u_tun.erl M src/gtp_utils.erl 5 files changed, 145 insertions(+), 38 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/conv.erl b/src/conv.erl index a041847..95e103d 100644 --- a/src/conv.erl +++ b/src/conv.erl @@ -38,7 +38,27 @@ -include_lib("gtp_utils.hrl"). -include_lib("conv.hrl"). --export([cause_gtp2gsup/1, gtp2_paa_to_epdg_eua/1, epdg_eua_to_gsup_pdp_address/1]). +-export([ip_to_bin/1, bin_to_ip/1]). +-export([cause_gtp2gsup/1]). +-export([gtp2_paa_to_epdg_eua/1, epdg_eua_to_gsup_pdp_address/1]). + +% ergw_aaa/src/ergw_aaa_3gpp_dict.erl +% under GPLv2+ +ip_to_bin(IP) when is_binary(IP) -> + IP; + ip_to_bin({A, B, C, D}) -> + <<A, B, C, D>>; + ip_to_bin({A, B, C, D, E, F, G, H}) -> + <<A:16, B:16, C:16, D:16, E:16, F:16, G:16, H:16>>. + + bin_to_ip(<<A:8, B:8, C:8, D:8>> = IP) when is_binary(IP) -> + {A, B, C, D}; + bin_to_ip(<<A:16, B:16, C:16, D:16, E:16, F:16, G:16, H:16>> = IP) when is_binary(IP) -> + {A, B, C, D, E, F, G, H}; + bin_to_ip({_, _, _, _} = IP) -> + IP; + bin_to_ip({_, _, _, _, _, _, _, _} = IP) -> + IP. -spec cause_gtp2gsup(integer()) -> integer(). diff --git a/src/epdg_gtpc_s2b.erl b/src/epdg_gtpc_s2b.erl index 9acbefa..05aed1b 100644 --- a/src/epdg_gtpc_s2b.erl +++ b/src/epdg_gtpc_s2b.erl @@ -258,6 +258,11 @@ lager:debug("Add bearer ~p to session ~p~n", [Bearer, Sess]), Sess#gtp_session{bearers = sets:add_element(Bearer, Sess#gtp_session.bearers)}. +gtp_session_update_bearer(Sess, OldBearer, NewBearer) -> + SetRemoved = sets:del_element(OldBearer, Sess#gtp_session.bearers), + SetUpdated = sets:add_element(NewBearer, SetRemoved), + Sess#gtp_session{bearers = SetUpdated}. + gtp_session_del_bearer(Sess, Bearer) -> lager:debug("Remove bearer ~p from session ~p~n", [Bearer, Sess]), Sess1 = Sess#gtp_session{bearers = sets:del_element(Bearer, Sess#gtp_session.bearers)}, @@ -269,25 +274,6 @@ gtp_session_default_bearer(Sess) -> gtp_session_find_bearer_by_ebi(Sess, Sess#gtp_session.default_bearer_id). - -update_gtp_session_from_create_session_response_ie(none, Sess) -> - Sess; -update_gtp_session_from_create_session_response_ie({_, - #v2_fully_qualified_tunnel_endpoint_identifier{ - interface_type = _Interface, - key = TEI, ipv4 = _IP4, ipv6 = _IP6}, - Next}, Sess) -> - update_gtp_session_from_create_session_response_ie(maps:next(Next), Sess#gtp_session{remote_control_tei = TEI}); -update_gtp_session_from_create_session_response_ie({_, _, Next}, - Sess) -> - update_gtp_session_from_create_session_response_ie(maps:next(Next), Sess). - -update_gtp_session_from_create_session_response_ies(#gtp{ie = IEs}, Sess) -> - update_gtp_session_from_create_session_response_ie(maps:next(maps:iterator(IEs)), Sess). - -update_gtp_session_from_create_session_response(Resp = #gtp{version = v2, type = create_session_response}, Sess) -> - update_gtp_session_from_create_session_response_ies(#gtp{ie = Resp#gtp.ie}, Sess). - % returns Sess if found, undefined it not find_gtp_session_by_local_teic(LocalControlTei, State) -> {LocalControlTei, Res} = sets:fold( @@ -313,13 +299,31 @@ lager:error("Rx unknown TEI ~p: ~p~n", [Resp#gtp.tei, Resp]), {noreply, State0}; Sess0 -> - Sess1 = update_gtp_session_from_create_session_response(Resp, Sess0), - lager:info("s2b: Updated Session after create_session_response: ~p~n", [Sess1]), - State1 = update_gtp_session(Sess0, Sess1, State0), % Do GTP specific msg parsing here, pass only relevant fields: - #{{v2_pdn_address_allocation,0} := Paa} = Resp#gtp.ie, + #{{v2_fully_qualified_tunnel_endpoint_identifier,1} := + #v2_fully_qualified_tunnel_endpoint_identifier{ + interface_type = 30, %% "S2b ePDG GTP-C" + key = RemoteTEIC, ipv4 = _IPc4, ipv6 = _IPc6}, + {v2_pdn_address_allocation,0} := Paa, + {v2_bearer_context,0} := #v2_bearer_context{instance = 0, group = BearerIE}} = Resp#gtp.ie, + % Parse BearerContext: + #{{v2_eps_bearer_id,0} := #v2_eps_bearer_id{instance = 0, eps_bearer_id = Ebi}, + {v2_fully_qualified_tunnel_endpoint_identifier,4} := + #v2_fully_qualified_tunnel_endpoint_identifier{ + interface_type = 31, %% "S2b-U ePDG GTP-U" + key = RemoteTEID, ipv4 = IPu4, ipv6 = IPu6} + } = BearerIE, + Bearer = gtp_session_find_bearer_by_ebi(Sess0, Ebi), + Sess1 = gtp_session_update_bearer(Sess0, Bearer, Bearer#gtp_bearer{remote_data_tei = RemoteTEID}), + Sess2 = Sess1#gtp_session{remote_control_tei = RemoteTEIC}, + lager:info("s2b: Updated Session after create_session_response: ~p~n", [Sess2]), + State1 = update_gtp_session(Sess0, Sess2, State0), ResInfo = #{ - eua => conv:gtp2_paa_to_epdg_eua(Paa) + eua => conv:gtp2_paa_to_epdg_eua(Paa), + local_teid => Bearer#gtp_bearer.local_data_tei, + remote_teid => RemoteTEID, + remote_ipv4 => IPu4, + remote_ipv6 => IPu6 }, epdg_ue_fsm:received_gtpc_create_session_response(Sess0#gtp_session.pid, {ok, ResInfo}), {noreply, State1} @@ -406,7 +410,7 @@ instance = Bearer#gtp_bearer.ebi, interface_type = 31, %% "S2b-U ePDG GTP-U" key = Bearer#gtp_bearer.local_data_tei, - ipv4 = gtp_utils:ip_to_bin(LocalAddr) + ipv4 = conv:ip_to_bin(LocalAddr) } ], IEs = [#v2_recovery{restart_counter = RCnt}, @@ -416,7 +420,7 @@ instance = 0, interface_type = 30, %% "S2b ePDG GTP-C" key = LocalCtlTEI, - ipv4 = gtp_utils:ip_to_bin(LocalAddr) + ipv4 = conv:ip_to_bin(LocalAddr) }, #v2_access_point_name{instance = 0, apn = [Apn]}, #v2_selection_mode{mode = 0}, @@ -438,7 +442,7 @@ instance = 0, interface_type = 30, %% "S2b ePDG GTP-C" key = Bearer#gtp_bearer.local_data_tei, - ipv4 = gtp_utils:ip_to_bin(LocalAddr) + ipv4 = conv:ip_to_bin(LocalAddr) } ], #gtp{version = v2, type = delete_session_request, tei = RemoteCtlTEI, seq_no = SeqNo, ie = IEs}. @@ -461,7 +465,7 @@ instance = 0, interface_type = 31, %% "S2b-U ePDG GTP-U" key = Bearer#gtp_bearer.local_data_tei, - ipv4 = gtp_utils:ip_to_bin(LocalAddr) + ipv4 = conv:ip_to_bin(LocalAddr) } ], IEs = [#v2_cause{v2_cause = GtpCause}, diff --git a/src/epdg_ue_fsm.erl b/src/epdg_ue_fsm.erl index fa780e8..7568db0 100644 --- a/src/epdg_ue_fsm.erl +++ b/src/epdg_ue_fsm.erl @@ -244,6 +244,16 @@ state_authenticated({call, From}, {received_gtpc_create_session_response, Result}, Data) -> lager:info("ue_fsm state_authenticated event=received_gtpc_create_session_response, ~p~n", [Data]), + case Result of + {ok, ResInfo} -> + #{eua := EUA, + local_teid := LocalTEID, + remote_teid := RemoteTEID, + remote_ipv4 := RemoteIPv4 % TODO: remote_ipv6 + } = ResInfo, + gtp_u_tun:create_pdp_context(RemoteIPv4, EUA, LocalTEID, RemoteTEID); + _ -> ok + end, gsup_server:tunnel_response(Data#ue_fsm_data.imsi, Result), {keep_state, Data, [{reply,From,ok}]}; diff --git a/src/gtp_u_tun.erl b/src/gtp_u_tun.erl new file mode 100644 index 0000000..e08b804 --- /dev/null +++ b/src/gtp_u_tun.erl @@ -0,0 +1,70 @@ +% GTP-U tun related functionalities +% +% (C) 2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> +% Author: Pau Espin Pedrol <pespin(a)sysmocom.de> +% +% All Rights Reserved +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU Affero General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU Affero General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +% Additional Permission under GNU AGPL version 3 section 7: +% +% If you modify this Program, or any covered work, by linking or +% combining it with runtime libraries of Erlang/OTP as released by +% Ericsson on http://www.erlang.org (or a modified version of these +% libraries), containing parts covered by the terms of the Erlang Public +% License (http://www.erlang.org/EPLICENSE) the licensors of this +% Program grant you additional permission to convey the resulting work +% without the need to license the runtime libraries of Erlang/OTP under +% the GNU Affero General Public License. Corresponding Source for a +% non-source form of such a combination shall include the source code +% for the parts of the runtime libraries of Erlang/OTP used as well as +% that of the covered work. + +-module(gtp_u_tun). +-author('Pau Espin Pedrol <pespin(a)sysmocom.de>'). +-include("conv.hrl"). + +-export([create_pdp_context/4]). + +%%%%%%%%%%%%%%%%%%%%%% +%%% Internal API +%%%%%%%%%%%%%%%%%%%%%% + +% Obtain ServerRef of the gtp_u_kmod_port process spawned during startup based on +% gtp_u_kmod config: +get_env_gtp_u_kmod_server_ref() -> + GtpuKmodSockets = application:get_env(gtp_u_kmod, sockets, []), + [GtpuKmodSocket | _] = GtpuKmodSockets, + {GtpuKmodName, _GtpuKmodSockOpts} = GtpuKmodSocket, + GtpuKmodServRef = gtp_u_kmod_port:port_reg_name(GtpuKmodName), + GtpuKmodServRef. + + +%%%%%%%%%%%%%%%%%%%%%% +%%% Internal API +%%%%%%%%%%%%%%%%%%%%%% + +% Create a PDP Context on the GTP tundev +create_pdp_context(PeerAddr, EUA, LocalTEID, RemoteTEID) -> + %SGSNaddr = {127,0,0,1}, % TODO: This should be set to the GTP-U IP address provided by the PGW + %EUA = {127,0,0,1}, % TODO: This should be set to the EUA IP address provided by the PGW + %LocalTEID = 1234, % TODO: this should be set to our locally generated TEID. + %RemoteTEID = 56768, % TODO: this should be set to TEID obtained from CreateSessionResponse + PeerIP = conv:bin_to_ip(PeerAddr), % TODO: IPv6 + UEIP = conv:bin_to_ip(EUA#epdg_eua.ipv4), % TODO: IPv6. + ok. + % TODO: This will be enabled once we depend on the gtp_u_kmod module: + %ServRef = get_env_gtp_u_kmod_server_ref(), + %gen_server:call(ServRef, {PeerIP, UEIP, LocalTEID, RemoteTEID}). \ No newline at end of file diff --git a/src/gtp_utils.erl b/src/gtp_utils.erl index eb0a23a..6098da2 100644 --- a/src/gtp_utils.erl +++ b/src/gtp_utils.erl @@ -35,16 +35,8 @@ -module(gtp_utils). -author('Alexander Couzens <lynxis(a)fe80.eu>'). --export([ip_to_bin/1, plmn_to_bin/3, enum_v2_cause/1]). +-export([plmn_to_bin/3, enum_v2_cause/1]). -% ergw_aaa/src/ergw_aaa_3gpp_dict.erl -% under GPLv2+ -ip_to_bin(IP) when is_binary(IP) -> - IP; -ip_to_bin({A, B, C, D}) -> - <<A, B, C, D>>; -ip_to_bin({A, B, C, D, E, F, G, H}) -> - <<A:16, B:16, C:16, D:16, E:16, F:16, G:16, H:16>>. % ergw/apps/ergw/test/*.erl % under GPLv2+ -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35906?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-epdg Gerrit-Branch: master Gerrit-Change-Id: I911985743af6b3fa90fd78631a562b85ecacce15 Gerrit-Change-Number: 35906 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • ...
  • 175
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.