pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35892?usp=email )
Change subject: gsup_server: Delete session if initial auth failed
......................................................................
gsup_server: Delete session if initial auth failed
It may be that due to a bug the previous session was kept alive and the
related epdg_ue_fsm has actually already terminated.
In any case, there's no use in keeping the session at this initial
transaction after having created it, so simply delete it if it fails.
Change-Id: Iebbab786e9647a026b2937115004747cd1883da0
---
M src/epdg_ue_fsm.erl
M src/gsup_server.erl
2 files changed, 23 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/92/35892/1
diff --git a/src/epdg_ue_fsm.erl b/src/epdg_ue_fsm.erl
index 21f59da..94cf9c4 100644
--- a/src/epdg_ue_fsm.erl
+++ b/src/epdg_ue_fsm.erl
@@ -37,7 +37,7 @@
-include_lib("osmo_gsup/include/gsup_protocol.hrl").
-include_lib("gtplib/include/gtp_packet.hrl").
--export([start_link/1]).
+-export([start_link/1, stop/1]).
-export([init/1,callback_mode/0,terminate/3]).
-export([auth_request/1, 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]).
@@ -57,6 +57,9 @@
lager:info("ue_fsm start_link(~p)~n", [ServerName]),
gen_statem:start_link({local, list_to_atom(ServerName)}, ?MODULE, Imsi, [{debug, [trace]}]).
+stop(SrvRef) ->
+ gen_statem:stop(SrvRef).
+
auth_request(Pid) ->
lager:info("ue_fsm auth_request~n", []),
try
diff --git a/src/gsup_server.erl b/src/gsup_server.erl
index 0c7a723..fd2a8b5 100644
--- a/src/gsup_server.erl
+++ b/src/gsup_server.erl
@@ -234,7 +234,7 @@
handle_info({ipa, Socket, ?IPAC_PROTO_EXT_GSUP, _GsupMsgRx = #{message_type := send_auth_info_req, imsi := Imsi}}, State0) ->
{UE, State1} = find_or_new_gsups_ue(Imsi, State0),
case epdg_ue_fsm:auth_request(UE#gsups_ue.pid) of
- ok -> ok;
+ ok -> State2 = State1;
{error, Err} ->
lager:error("Auth Req for Imsi ~p failed: ~p~n", [Imsi, Err]),
Resp = #{message_type => send_auth_info_err,
@@ -242,9 +242,11 @@
message_class => 5,
cause => ?GSUP_CAUSE_NET_FAIL
},
- tx_gsup(Socket, Resp)
+ tx_gsup(Socket, Resp),
+ epdg_ue_fsm:stop(UE#gsups_ue.pid),
+ State2 = delete_gsups_ue(Imsi, State1)
end,
- {noreply, State1};
+ {noreply, State2};
% location update request / when a UE wants to connect to a specific APN. This will trigger a AAA->HLR Request Server Assignment Request
% FIXME: add APN instead of hardcoded internet
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35892?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: Iebbab786e9647a026b2937115004747cd1883da0
Gerrit-Change-Number: 35892
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35895?usp=email )
Change subject: epdg_diameter_swm: Update PID if session already exists
......................................................................
epdg_diameter_swm: Update PID if session already exists
If the FSM was recreated, during the first step it may have a different
PID. Update it so that we send the answer back to the proper PID.
Change-Id: I5e4f0ff4292c364f47d61ba629df50e8e3d35017
---
M src/epdg_diameter_swm.erl
1 file changed, 22 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/95/35895/1
diff --git a/src/epdg_diameter_swm.erl b/src/epdg_diameter_swm.erl
index 57c0921..800df44 100644
--- a/src/epdg_diameter_swm.erl
+++ b/src/epdg_diameter_swm.erl
@@ -181,7 +181,15 @@
Sess = find_swm_session_by_imsi(Imsi, State),
case Sess of
#swm_session{imsi = Imsi} ->
- {Sess, State};
+ % Update Pid since it may have changed:
+ Sess1 = Sess#swm_session{pid = Pid},
+ State1 = update_swm_session(Sess, Sess1, State),
+ {Sess1, State1};
undefined ->
new_swm_session(Imsi, Pid, State)
- end.
\ No newline at end of file
+ end.
+
+update_swm_session(OldSess, NewSess, State) ->
+ SetRemoved = sets:del_element(OldSess, State#swm_state.sessions),
+ SetUpdated = sets:add_element(NewSess, SetRemoved),
+ State#swm_state{sessions = SetUpdated}.
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35895?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: I5e4f0ff4292c364f47d61ba629df50e8e3d35017
Gerrit-Change-Number: 35895
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email )
Change subject: tbf_ul: Clean and assert code path generating new UL data block
......................................................................
tbf_ul: Clean and assert code path generating new UL data block
Clarify the several paths when generating a new BSN (UL data block).
The function create_new_bsn() is only called if there's some LLC frame
ready to be transmitted and put in ul_tbf->llc_tx_msg, so the do while
{} condition checking for no llc_tx_msg is guaranteed to only be run in
the event some LLC frame chunks have been included in the UL RLC block.
This fact allows simplifying the code and at the same time fix a
Coverity CID regarding a code path which could not really happen. We now
guard this case with an ASSERT.
Related: Coverity CID#345063
Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
---
M src/rlcmac/tbf_ul.c
1 file changed, 37 insertions(+), 15 deletions(-)
Approvals:
jolly: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c
index 0ea0a9c..67c9e98 100644
--- a/src/rlcmac/tbf_ul.c
+++ b/src/rlcmac/tbf_ul.c
@@ -684,6 +684,7 @@
if (!ul_tbf->llc_tx_msg || msgb_length(ul_tbf->llc_tx_msg) == 0)
gprs_rlcmac_ul_tbf_schedule_next_llc_frame(ul_tbf);
+ /* This function shall only be called if there's some LLC payload not yet transmitted: */
OSMO_ASSERT(ul_tbf->llc_tx_msg);
OSMO_ASSERT(gprs_rlcmac_mcs_is_valid(cs));
@@ -734,27 +735,29 @@
int payload_written = 0;
if (!ul_tbf->llc_tx_msg || msgb_length(ul_tbf->llc_tx_msg) == 0) {
+ const int space = block_data_len - write_offset;
+ /* Only get here in case we already encoded the end of
+ * some LLC payload chunk and there's no more new LLC
+ * payloads to send */
+ OSMO_ASSERT(num_chunks > 0);
+
/* The data just drained, store the current fn */
if (ul_tbf->last_ul_drained_fn < 0)
ul_tbf->last_ul_drained_fn = bi->fn;
- int space = block_data_len - write_offset;
+ /* Nothing to send, and we already put some data in
+ * rlcmac data block, we are done */
+ LOGPTBFUL(ul_tbf, LOGL_DEBUG,
+ "LLC queue completely drained and there's "
+ "still %d free bytes in rlcmac data block\n", space);
- if (num_chunks != 0) {
- /* Nothing to send, and we already put some data in
- * rlcmac data block, we are done */
- LOGPTBFUL(ul_tbf, LOGL_DEBUG,
- "LLC queue completely drained and there's "
- "still %d free bytes in rlcmac data block\n", space);
-
- if (gprs_rlcmac_mcs_is_edge(cs)) {
- /* in EGPRS there's no M bit, so we need
- * to flag padding with LI=127 */
- gprs_rlcmac_rlc_data_to_ul_append_egprs_li_padding(
- rdbi, &write_offset, &num_chunks, data);
- }
- break;
+ if (gprs_rlcmac_mcs_is_edge(cs)) {
+ /* in EGPRS there's no M bit, so we need to flag
+ * padding with LI=127 */
+ gprs_rlcmac_rlc_data_to_ul_append_egprs_li_padding(
+ rdbi, &write_offset, &num_chunks, data);
}
+ break;
}
ar = gprs_rlcmac_enc_append_ul_data(rdbi, cs, ul_tbf->llc_tx_msg, &write_offset,
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
Gerrit-Change-Number: 35882
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: pespin.
jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email )
Change subject: tbf_ul: Clean and assert code path generating new UL data block
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
Gerrit-Change-Number: 35882
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Feb 2024 09:47:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment