laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36207?usp=email )
Change subject: rename hnbgw_peek_l3 to hnbgw_peek_l3_ul as it's uplink only
......................................................................
rename hnbgw_peek_l3 to hnbgw_peek_l3_ul as it's uplink only
Let's not make the functions appear more generic than they are: They
all explicitly only support uplink so far.
Change-Id: I7db0d933a8f17f8c410141f43dab12b8c19fc8ae
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw_l3.c
M src/osmo-hnbgw/hnbgw_rua.c
3 files changed, 22 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/07/36207/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 98cdc34..58b0903 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -430,4 +430,4 @@
struct msgb *hnbgw_ranap_msg_alloc(const char *name);
-int hnbgw_peek_l3(struct hnbgw_context_map *map, struct msgb *ranap_msg);
+int hnbgw_peek_l3_ul(struct hnbgw_context_map *map, struct msgb *ranap_msg);
diff --git a/src/osmo-hnbgw/hnbgw_l3.c b/src/osmo-hnbgw/hnbgw_l3.c
index a6b48ce..1fd3398 100644
--- a/src/osmo-hnbgw/hnbgw_l3.c
+++ b/src/osmo-hnbgw/hnbgw_l3.c
@@ -156,8 +156,8 @@
return 0;
}
-static int peek_l3_nas(struct hnbgw_context_map *map, const uint8_t *nas_pdu, size_t len,
- const struct osmo_plmn_id *local_plmn)
+static int peek_l3_ul_nas(struct hnbgw_context_map *map, const uint8_t *nas_pdu, size_t len,
+ const struct osmo_plmn_id *local_plmn)
{
const struct gsm48_hdr *gh;
int8_t pdisc;
@@ -277,7 +277,7 @@
return 0;
}
-static int peek_l3_initial_ue(struct hnbgw_context_map *map, const RANAP_InitialUE_MessageIEs_t *ies)
+static int peek_l3_ul_initial_ue(struct hnbgw_context_map *map, const RANAP_InitialUE_MessageIEs_t *ies)
{
struct osmo_plmn_id local_plmn;
@@ -293,12 +293,12 @@
osmo_plmn_from_bcd(ies->lai.pLMNidentity.buf, &local_plmn);
}
- return peek_l3_nas(map, ies->nas_pdu.buf, ies->nas_pdu.size, &local_plmn);
+ return peek_l3_ul_nas(map, ies->nas_pdu.buf, ies->nas_pdu.size, &local_plmn);
}
-/* Extract a Layer 3 message (NAS PDU) from the RANAP message, and put the info obtained in map->l3. This is relevant
- * for CN pooling, to decide which CN link to map the RUA context to. */
-int hnbgw_peek_l3(struct hnbgw_context_map *map, struct msgb *ranap_msg)
+/* Extract a Layer 3 message (NAS PDU) from the uplink RANAP message, and put the info obtained in map->l3.
+ * This is relevant for CN pooling, to decide which CN link to map the RUA context to. */
+int hnbgw_peek_l3_ul(struct hnbgw_context_map *map, struct msgb *ranap_msg)
{
ranap_message *message = hnbgw_decode_ranap_co(ranap_msg);
if (!message) {
@@ -308,7 +308,7 @@
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_InitialUE_Message:
- return peek_l3_initial_ue(map, &message->msg.initialUE_MessageIEs);
+ return peek_l3_ul_initial_ue(map, &message->msg.initialUE_MessageIEs);
default:
LOGP(DCN, LOGL_ERROR, "unexpected RANAP PDU in RUA Connect message: %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
diff --git a/src/osmo-hnbgw/hnbgw_rua.c b/src/osmo-hnbgw/hnbgw_rua.c
index ae518c0..5576fa4 100644
--- a/src/osmo-hnbgw/hnbgw_rua.c
+++ b/src/osmo-hnbgw/hnbgw_rua.c
@@ -194,7 +194,7 @@
map = context_map_alloc(hnb, rua_ctx_id, is_ps);
OSMO_ASSERT(map);
- if (hnbgw_peek_l3(map, ranap_msg))
+ if (hnbgw_peek_l3_ul(map, ranap_msg))
LOGP(DCN, LOGL_NOTICE, "Failed to extract Mobile Identity from RUA Connect message's RANAP payload\n");
/* map->l3 now contains all the interesting information from the NAS PDU, if any.
* If no useful information could be decoded, still continue to select a hopefully adequate link by round robin.
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36207?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I7db0d933a8f17f8c410141f43dab12b8c19fc8ae
Gerrit-Change-Number: 36207
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36204?usp=email )
Change subject: Introduce umts_cell_id_from_str() as inverse of umts_cell_id_name()
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36204?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I6da947d1f2316241e44e53bb6aaec4221cfaa2c0
Gerrit-Change-Number: 36204
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 08 Mar 2024 12:21:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
pespin has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36196?usp=email )
Change subject: Move spawn_wait_ret() to a new misc.erl file
......................................................................
Move spawn_wait_ret() to a new misc.erl file
It may be reused by other modules spawning process per message, like
gsup_server.erl.
Change-Id: I9777b73942e9dc672dd944a82045710b78893974
---
M src/epdg_gtpc_s2b.erl
A src/misc.erl
2 files changed, 68 insertions(+), 20 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/epdg_gtpc_s2b.erl b/src/epdg_gtpc_s2b.erl
index a8a42a2..dce038f 100644
--- a/src/epdg_gtpc_s2b.erl
+++ b/src/epdg_gtpc_s2b.erl
@@ -188,10 +188,10 @@
%% @callback gen_server
handle_info({udp, _Socket, IP, InPortNo, RxMsg}, State) ->
lager:debug("S2b: Rx from IP ~p port ~p: ~p~n", [IP, InPortNo, RxMsg]),
- spawn_wait_ret(fun() ->
- rx_udp(IP, InPortNo, RxMsg, State)
- end,
- {noreply, State});
+ misc:spawn_wait_ret(fun() ->
+ rx_udp(IP, InPortNo, RxMsg, State)
+ end,
+ {noreply, State});
handle_info(Info, State) ->
lager:info("S2b handle_info: ~p ~n", [Info]),
{noreply, State}.
@@ -378,22 +378,6 @@
connect(Address) ->
connect(?SVC_NAME, Address).
-%% Calls Fun on a spawned monitored process and returns Fun ret.
-%% If spawned process crashes, return DefaultRet.
-spawn_wait_ret(Fun, DefaultRet) ->
- MyPID=self(),
- {Pid, MRef} = spawn_monitor(fun() ->
- Ret = Fun(),
- MyPID ! {self(), Ret}
- end),
- receive
- {'DOWN', MRef, process, _, _Reason} ->
- DefaultRet;
- {Pid, Ret} ->
- erlang:demonitor(MRef, [flush]),
- Ret
- end.
-
rx_udp(IP, InPortNo, RxMsg, State) ->
Req = gtp_packet:decode(RxMsg),
lager:debug("S2b: Rx from IP ~p port ~p: ~p~n", [IP, InPortNo, Req]),
diff --git a/src/misc.erl b/src/misc.erl
new file mode 100644
index 0000000..fd85264
--- /dev/null
+++ b/src/misc.erl
@@ -0,0 +1,52 @@
+% Misc helpers
+% (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.
+%
+-module(misc).
+-author('Pau Espin Pedrol <pespin(a)sysmocom.de>').
+
+-export([spawn_wait_ret/2]).
+
+%% Calls Fun on a spawned monitored process and returns Fun ret.
+%% If spawned process crashes, return DefaultRet.
+spawn_wait_ret(Fun, DefaultRet) ->
+ MyPID=self(),
+ {Pid, MRef} = spawn_monitor(fun() ->
+ Ret = Fun(),
+ MyPID ! {self(), Ret}
+ end),
+ receive
+ {'DOWN', MRef, process, _, _Reason} ->
+ DefaultRet;
+ {Pid, Ret} ->
+ erlang:demonitor(MRef, [flush]),
+ Ret
+ end.
\ No newline at end of file
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36196?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: I9777b73942e9dc672dd944a82045710b78893974
Gerrit-Change-Number: 36196
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-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36199?usp=email )
Change subject: gsup_server: Spawn one process per rx message
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36199?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: Ifb5ece08007be59657d0d2f428e9d991af696026
Gerrit-Change-Number: 36199
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 08 Mar 2024 12:15:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36198?usp=email )
Change subject: gsup_server: Look up epdg_ue_fsm process each time it needs to be accessed
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36198?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: I80203a7cf0efe82eec3773ee773d25310c07a2c3
Gerrit-Change-Number: 36198
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 08 Mar 2024 12:15:22 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36197?usp=email )
Change subject: gsup_server: Move rx_gsup path to its own function
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36197?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: Ie551ed14f7ab8c447f25981a6a1d6ed4ddb470b7
Gerrit-Change-Number: 36197
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 08 Mar 2024 12:15:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment