fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42290?usp=email )
Change subject: erab_fsm: fix comment inaccuracies and a typo
......................................................................
erab_fsm: fix comment inaccuracies and a typo
Two comments copy-pasted from session_establish were left saying
"ESTABLISH Req" in session_modify and session_delete handlers where
"MODIFY Req" and "DELETE Req" are correct respectively.
Also fix typo "unieue" -> "unique" in init/1.
Change-Id: If84638142988767363aa080012b44082dee39f90
---
M src/erab_fsm.erl
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/90/42290/1
diff --git a/src/erab_fsm.erl b/src/erab_fsm.erl
index f281e4b..1e39cb7 100644
--- a/src/erab_fsm.erl
+++ b/src/erab_fsm.erl
@@ -233,7 +233,7 @@
init([UID]) ->
set_logging_prefix(UID),
?LOG_DEBUG("Creating E-RAB FSM (UID ~p)", [UID]),
- %% request a unieue SEID for this E-RAB FSM
+ %% request a unique SEID for this E-RAB FSM
{ok, SEID} = pfcp_peer:seid_alloc(),
{ok, erab_wait_setup_req,
#erab_state{uid = UID,
@@ -360,7 +360,7 @@
{reply, From, {error, {timeout, ?FUNCTION_NAME}}}};
session_modify(info, #pfcp{type = session_modification_response,
- seid = SEID_Rsp, %% matches F-SEID we sent in the ESTABLISH Req
+ seid = SEID_Rsp, %% matches F-SEID we sent in the MODIFY Req
ie = #{pfcp_cause := 'Request accepted'}},
#erab_state{mod_kind = ModKind,
from = From,
@@ -504,7 +504,7 @@
rel_kind = RelKind} = S) ->
case PDU of
#pfcp{type = session_deletion_response,
- seid = SEID_Rsp, %% matches F-SEID we sent in the ESTABLISH Req
+ seid = SEID_Rsp, %% matches F-SEID we sent in the DELETE Req
ie = #{pfcp_cause := 'Request accepted'}} ->
?LOG_DEBUG("PFCP session deleted"),
case RelKind of
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42290?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: If84638142988767363aa080012b44082dee39f90
Gerrit-Change-Number: 42290
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42292?usp=email )
Change subject: pfcp_peer: replace deprecated erlang:timestamp/0 with os:system_time/1
......................................................................
pfcp_peer: replace deprecated erlang:timestamp/0 with os:system_time/1
erlang:timestamp/0 is deprecated since OTP 18. os:system_time(second)
is the modern replacement and yields the result directly in seconds,
removing the need to reassemble the {MegaSec, Sec, _} tuple.
Change-Id: I4ad886a2222f0cee8a668b42efe8bfac800a55ac
---
M src/pfcp_peer.erl
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/92/42292/1
diff --git a/src/pfcp_peer.erl b/src/pfcp_peer.erl
index a4cc2d5..e1b3aa1 100644
--- a/src/pfcp_peer.erl
+++ b/src/pfcp_peer.erl
@@ -477,11 +477,10 @@
-spec get_recovery_timestamp() -> pos_integer().
get_recovery_timestamp() ->
- {NowMS, NowS, _NowUS} = erlang:timestamp(),
- %% erlang:timestamp() returns time relative to the UNIX epoch (1970),
+ %% os:system_time/1 returns time relative to the UNIX epoch (1970),
%% but for PFCP we need time relative to the NTP era 0 (1900).
%% 2208988800 is the diff between 1900 and 1970.
- NowMS * 1_000_000 + NowS + 2208988800.
+ os:system_time(second) + 2208988800.
-spec get_f_seid(pfcp_seid(), peer_state()) -> pfcp_f_seid().
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42292?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I4ad886a2222f0cee8a668b42efe8bfac800a55ac
Gerrit-Change-Number: 42292
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42294?usp=email )
Change subject: s1ap_proxy: fix discarded result of handle_ies/3 in HO REQ ACK handler
......................................................................
s1ap_proxy: fix discarded result of handle_ies/3 in HO REQ ACK handler
The call processing the optional E-RABFailedToSetupListHOReqAck IE did
not pattern-match its return value, causing any errors returned by
handle_ies/3 to be silently swallowed. Bind the result to {_, S2}
to make the intent explicit.
Change-Id: I1c8feeb63fe23876ae443784980e9dc22a450c54
---
M src/s1ap_proxy.erl
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/94/42294/1
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index a29a817..ef7665e 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -604,8 +604,8 @@
end,
%% handle the (optional) list of failed E-RABs
%% no #proxy_state modification is expected here
- handle_ies(?'id-E-RABFailedToSetupListHOReqAck',
- C0#'HandoverRequestAcknowledge'.protocolIEs, S2),
+ {_, S2} = handle_ies(?'id-E-RABFailedToSetupListHOReqAck',
+ C0#'HandoverRequestAcknowledge'.protocolIEs, S2),
{Result, S2};
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42294?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I1c8feeb63fe23876ae443784980e9dc22a450c54
Gerrit-Change-Number: 42294
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42296?usp=email )
Change subject: enb_registry: fix pattern match in handle_info 'DOWN' handler
......................................................................
enb_registry: fix pattern match in handle_info 'DOWN' handler
PIDs maps pid() => enb_handle() (an integer), so maps:find/2 returns
{ok, SomeHandle}. The old pattern {ok, Pid} tried to match an integer
against the already-bound pid() variable, which never succeeds.
This handler is only called on abnormal termination (process crash),
so the broken match caused the registry entry to never be cleaned up
in that case. Fix by using a fresh {ok, Handle} binding and removing
the now-redundant follow-up maps:get/2 call.
Change-Id: I4cb044e8071c4ae2fc48c507f8733af6c617ec46
---
M src/enb_registry.erl
1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/96/42296/1
diff --git a/src/enb_registry.erl b/src/enb_registry.erl
index 54eca5d..d2487a0 100644
--- a/src/enb_registry.erl
+++ b/src/enb_registry.erl
@@ -257,8 +257,7 @@
pids = PIDs} = S) ->
?LOG_INFO("eNB process (pid=~p) terminated with reason ~p", [Pid, Reason]),
case maps:find(Pid, PIDs) of
- {ok, Pid} ->
- Handle = maps:get(Pid, PIDs),
+ {ok, Handle} ->
enb_metrics_reset(maps:get(Handle, ENBs)),
?LOG_INFO("eNB (handle=~p, pid=~p) has been unregistered", [Handle, Pid]),
{noreply, S#state{enbs = maps:remove(Handle, ENBs),
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42296?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I4cb044e8071c4ae2fc48c507f8733af6c617ec46
Gerrit-Change-Number: 42296
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42297?usp=email )
Change subject: enb_registry: fix duplicate registration check in enb_register/0
......................................................................
enb_registry: fix duplicate registration check in enb_register/0
next_handle was bound in the function head and reused in the case
pattern {ok, Handle}, turning what looks like a binding into an
equality test against next_handle. The duplicate check therefore
only fired if the previously assigned handle happened to equal the
current next_handle counter, which is essentially never true.
Fix by removing next_handle from the function head pattern and reading
it with S#state.next_handle inside the error branch, so that Handle in
{ok, Handle} is always a fresh binding that matches any existing handle.
Change-Id: Ia64f3e2e79bea055e5c37df9bce91a4bcbf7184c
---
M src/enb_registry.erl
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/97/42297/1
diff --git a/src/enb_registry.erl b/src/enb_registry.erl
index d2487a0..29a2575 100644
--- a/src/enb_registry.erl
+++ b/src/enb_registry.erl
@@ -155,13 +155,13 @@
handle_call(enb_register,
{Pid, _Tag},
#state{enbs = ENBs,
- pids = PIDs,
- next_handle = Handle} = S) ->
+ pids = PIDs} = S) ->
case maps:find(Pid, PIDs) of
{ok, Handle} ->
?LOG_ERROR("eNB (handle=~p, pid=~p) is *already* registered", [Handle, Pid]),
{reply, {error, already_registered}, S};
error ->
+ Handle = S#state.next_handle,
%% keep an eye on the process being registered
MonRef = erlang:monitor(process, Pid),
%% create and store an initial eNB state
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42297?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ia64f3e2e79bea055e5c37df9bce91a4bcbf7184c
Gerrit-Change-Number: 42297
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>