Change in osmo-pcu[master]: tests/rlcmac: additionally match debug output of the CSN.1 codec

2020-02-16 Thread fixeria
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-pcu/+/17192

to look at the new patch set (#2).

Change subject: tests/rlcmac: additionally match debug output of the CSN.1 codec
..

tests/rlcmac: additionally match debug output of the CSN.1 codec

This would allow us to catch more bugs. Note that I had to remove
printing of pointer address to make the output deterministic.

Change-Id: I1a77441eb957353c919bc73f8e3a2e38f4a383a9
---
M src/csn1.cpp
M tests/Makefile.am
M tests/rlcmac/RLCMACTest.cpp
A tests/rlcmac/RLCMACTest.err
M tests/testsuite.at
5 files changed, 43 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/92/17192/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17192
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I1a77441eb957353c919bc73f8e3a2e38f4a383a9
Gerrit-Change-Number: 17192
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-pcu[master]: csn1: get rid of C++ specific code, compile with GCC

2020-02-16 Thread fixeria
Hello pespin, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-pcu/+/17010

to look at the new patch set (#4).

Change subject: csn1: get rid of C++ specific code, compile with GCC
..

csn1: get rid of C++ specific code, compile with GCC

The implementation of CSN.1 codec was taken from Wireshark, where
it's implemented in pure C. For some reason it was mixed with C++
specific features, mostly using references in parameter
declaration. Not sure what are the benefits.

Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
---
M src/Makefile.am
R src/csn1.c
M src/csn1.h
M src/gsm_rlcmac.cpp
M src/gsm_rlcmac.h
M tests/rlcmac/RLCMACTest.cpp
6 files changed, 209 insertions(+), 213 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/10/17010/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17010
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
Gerrit-Change-Number: 17010
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-pcu[master]: tests/rlcmac: additionally match debug output of the CSN.1 codec

2020-02-16 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/17192 )


Change subject: tests/rlcmac: additionally match debug output of the CSN.1 codec
..

tests/rlcmac: additionally match debug output of the CSN.1 codec

This would allow us to catch more bugs. Note that I had to remove
printing of pointer address to make the output deterministic.

Change-Id: I1a77441eb957353c919bc73f8e3a2e38f4a383a9
---
M src/csn1.cpp
M tests/rlcmac/RLCMACTest.cpp
A tests/rlcmac/RLCMACTest.err
M tests/testsuite.at
4 files changed, 42 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/92/17192/1

diff --git a/src/csn1.cpp b/src/csn1.cpp
index 7be28a1..b2ae1f2 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -564,7 +564,7 @@

 csnStreamInit(, bit_offset, length > 0 ? length : 
remaining_bits_len);
 arT.direction = 1;
-LOGPC(DCSN1, LOGL_NOTICE, "ptr = %p | offset = %d | ", (void *)data, 
(int)pDescr->offset);
+LOGPC(DCSN1, LOGL_NOTICE, "offset = %d | ", (int)pDescr->offset);
Status = serialize(, vector, readIndex, pvDATA(data, 
pDescr->offset));

 if (Status >= 0)
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index 1f74e41..0cc3347 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -256,7 +256,13 @@
 {
void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
osmo_init_logging2(ctx, _log_info);
-   log_parse_category_mask(osmo_stderr_target, "DPCU,3:DLGLOBAL,1:");
+   log_parse_category_mask(osmo_stderr_target, 
"DPCU,3:DLGLOBAL,1:DCSN1,2:");
+
+   log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
+   log_set_print_category_hex(osmo_stderr_target, 0);
+   log_set_print_category(osmo_stderr_target, 1);
+   log_set_print_level(osmo_stderr_target, 1);
+   log_set_use_color(osmo_stderr_target, 0);

//printSizeofRLCMAC();
testRlcMacDownlink(ctx);
diff --git a/tests/rlcmac/RLCMACTest.err b/tests/rlcmac/RLCMACTest.err
new file mode 100644
index 000..33643f3
--- /dev/null
+++ b/tests/rlcmac/RLCMACTest.err
@@ -0,0 +1,32 @@
+DCSN1 INFO csnStreamDecoder (type=2): MESSAGE_TYPE = 2 | PAGE_MODE = 0 | 
Exist_PERSISTENCE_LEVEL = 0 |  : ID | Choice PacketDownlinkID = 0 |  : 
u.Global_TFI | u.DOWNLINK_TFI = 1 | u.DOWNLINK_TFI = 5 | : End u.Global_TFI | : 
End ID | 0x00 = 0 | MAC_MODE = 0 | RLC_MODE = 0 | CONTROL_ACK = 0 | 
TIMESLOT_ALLOCATION = 28 |  : Packet_Timing_Advance | 
Exist_TIMING_ADVANCE_VALUE = 0 | Exist_IndexAndtimeSlot = 1 | 
TIMING_ADVANCE_INDEX = 15 | TIMING_ADVANCE_TIMESLOT_NUMBER = 4 | : End 
Packet_Timing_Advance | Exist_P0_and_BTS_PWR_CTRL_MODE = 0 | 
Exist_Frequency_Parameters = 1 |  : Frequency_Parameters | TSC = 5 | 
u.Indirect_encoding = 1 |  : u.Indirect_encoding | MAIO = 0 | MA_NUMBER = 14 | 
Exist_CHANGE_MARK = 1 |  : CHANGE_MARK | CHANGE_MARK_1 = 0 | 
Exist_CHANGE_MARK_2 = 0 | : End CHANGE_MARK |  : End u.Indirect_encoding | : 
End Frequency_Parameters | Exist_DOWNLINK_TFI_ASSIGNMENT = 0 | 
Exist_Power_Control_Parameters = 1 |  : Power_Control_Parameters | ALPHA = 0 | 
Slot[0].Exist = 0 | Slot[1].Exist = 0 | Slot[2].Exist = 0 | Slot[3].Exist = 1 | 
Slot[3].GAMMA_TN = 0 | Slot[4].Exist = 1 | Slot[4].GAMMA_TN = 0 | Slot[5].Exist 
= 1 | Slot[5].GAMMA_TN = 0 | Slot[6].Exist = 0 | Slot[7].Exist = 0 | : End 
Power_Control_Parameters | Exist_TBF_Starting_Time = 0 | 
Exist_Measurement_Mapping = 0 | Exist_AdditionsR99 = 0 | Padding = 
11|43|43|43|43|43|43|43|43|43|43|
+DCSN1 INFO csnStreamEncoder (type=2): MESSAGE_TYPE = 2 | PAGE_MODE = 0 | 
Exist_PERSISTENCE_LEVEL = 0 |  : ID | u.Global_TFI = 0 |  : u.Global_TFI | 
u.DOWNLINK_TFI = 1 | u.DOWNLINK_TFI = 5 |  : End u.Global_TFI |  : End ID | 
0x00 = 0 | MAC_MODE = 0 | RLC_MODE = 0 | CONTROL_ACK = 0 | TIMESLOT_ALLOCATION 
= 28 |  : Packet_Timing_Advance | Exist_TIMING_ADVANCE_VALUE = 0 | 
Exist_IndexAndtimeSlot = 1 | TIMING_ADVANCE_INDEX = 15 | 
TIMING_ADVANCE_TIMESLOT_NUMBER = 4 |  : End Packet_Timing_Advance | 
Exist_P0_and_BTS_PWR_CTRL_MODE = 0 | Exist_Frequency_Parameters = 1 |  : 
Frequency_Parameters | TSC = 5 | u.Indirect_encoding = 1 |  : 
u.Indirect_encoding | MAIO = 0 | MA_NUMBER = 14 | Exist_CHANGE_MARK = 1 |  : 
CHANGE_MARK | CHANGE_MARK_1 = 0 | Exist_CHANGE_MARK_2 = 0 |  : End CHANGE_MARK 
|  : End u.Indirect_encoding |  : End Frequency_Parameters | 
Exist_DOWNLINK_TFI_ASSIGNMENT = 0 | Exist_Power_Control_Parameters = 1 |  : 
Power_Control_Parameters | ALPHA = 0 | Slot[0].Exist = 0 | Slot[1].Exist = 0 | 
Slot[2].Exist = 0 | Slot[3].Exist = 1 | Slot[3].GAMMA_TN = 0 | Slot[4].Exist = 
1 | Slot[4].GAMMA_TN = 0 | Slot[5].Exist = 1 | Slot[5].GAMMA_TN = 0 | 
Slot[6].Exist = 0 | Slot[7].Exist = 0 |  : End Power_Control_Parameters | 
Exist_TBF_Starting_Time = 0 | Exist_Measurement_Mapping = 0 | 
Exist_AdditionsR99 = 0 | Padding = 

Change in osmo-pcu[master]: csn1: get rid of C++ specific code, compile with GCC

2020-02-16 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/17010 )

Change subject: csn1: get rid of C++ specific code, compile with GCC
..


Patch Set 3:

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17010
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
Gerrit-Change-Number: 17010
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Sun, 16 Feb 2020 17:43:13 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-pcu[master]: csn1: fix existNextElement(): use bitvec_get_bit_pos()

2020-02-16 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/17191 )


Change subject: csn1: fix existNextElement(): use bitvec_get_bit_pos()
..

csn1: fix existNextElement(): use bitvec_get_bit_pos()

As was discovered recently (see OS#4388), bitvec_read_field()
would never return a negative value because its return type
is unsigned (uint64_t).

We don't really need to get more than one bit, so let's just
use the bitvec_get_bit_pos() instead.

Change-Id: I763a295cd955cd33f542292c85d97ff82f6b49bc
Related: OS#4388
---
M src/csn1.cpp
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/91/17191/1

diff --git a/src/csn1.cpp b/src/csn1.cpp
index 5928d69..7be28a1 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -137,7 +137,7 @@
 static gboolean
 existNextElement(bitvec *vector, unsigned& readIndex, guint8 Tag)
 {
-  guint8 res = bitvec_read_field(vector, , 1);
+  int res = bitvec_get_bit_pos(vector, readIndex++);
   if (Tag == STANDARD_TAG)
   {
 return (res > 0);

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17191
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I763a295cd955cd33f542292c85d97ff82f6b49bc
Gerrit-Change-Number: 17191
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: remsim: Add client TC_bank_disconnect + TC_bank_disconnect_reconnect

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17190 )


Change subject: remsim: Add client TC_bank_disconnect + 
TC_bank_disconnect_reconnect
..

remsim: Add client TC_bank_disconnect + TC_bank_disconnect_reconnect

This extends remsim-client test coverage to situations where the
server removes an existing/established mapping, and possibly later
establishes a new mapping.

Change-Id: I8df29a91718b6b2829415fc040b647a58eb71292
Related: OS#4399
---
M remsim/RemsimClient_Tests.ttcn
1 file changed, 62 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/90/17190/1

diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index 7bee899..d950152 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -109,6 +109,66 @@
f_sleep(1.0);
 }

+/* Test if client disconnects from bankd after slotmap delete on server */
+testcase TC_bank_disconnect() runs on client_test_CT {
+   var BankSlot bslot := { 1, 0 };
+   f_init();
+   /* expect inbound connectClientReq */
+   as_connectClientReq();
+   /* configure client to connect to [simulated] bankd */
+   f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), 
mp_bankd_port));
+   /* expect inbound connect on simulated bankd */
+   f_rspro_srv_exp_connect(1);
+   /* expect inbound connectClientReq on simulated bankd */
+   as_connectClientReq(i := 1);
+
+   f_sleep(1.0);
+
+   /* configure client to disconnect from [simulated] bankd */
+   f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4("0.0.0.0"), 0));
+
+   /* expect disconnect of client on simulated bankd side */
+   RSPRO_SRV[1].receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_DOWN));
+   setverdict(pass);
+}
+
+/* Test if client connects to bankd after disconnects from bankd after slotmap 
delete on server */
+testcase TC_bank_disconnect_reconnect() runs on client_test_CT {
+   var BankSlot bslot := { 1, 0 };
+   f_init();
+   /* expect inbound connectClientReq */
+   as_connectClientReq();
+   /* configure client to connect to [simulated] bankd */
+   f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), 
mp_bankd_port));
+   /* expect inbound connect on simulated bankd */
+   f_rspro_srv_exp_connect(1);
+   /* expect inbound connectClientReq on simulated bankd */
+   as_connectClientReq(i := 1);
+
+   f_sleep(1.0);
+
+   /* configure client to disconnect from [simulated] bankd */
+   f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4("0.0.0.0"), 0));
+
+   /* expect disconnect of client on simulated bankd side */
+   RSPRO_SRV[1].receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_DOWN));
+
+   /* re-start the IPA emulation (which terminated itself on the TCP 
disconnect */
+   f_rspro_srv_init(1, mp_bankd_ip, mp_bankd_port, g_bankd_comp_id, 
exp_connect := false);
+
+   /* configure client to connect to [simulated] bankd */
+   f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), 
mp_bankd_port));
+
+   /* expect inbound connect on simulated bankd */
+   f_rspro_srv_exp_connect(1);
+
+   /* expect inbound connect on simulated bankd */
+   as_connectClientReq(i := 1);
+
+   setverdict(pass);
+}
+
+
 /* TODO:
* send a configClientBankIpReq and change the bank of an active client
* send a configClientBankSlotReq and chagne the bank slot of an active 
client
@@ -125,6 +185,8 @@
execute( TC_srv_connectClient_configClientBank() );
execute( TC_srv_reconnect() );
execute( TC_bank_reconnect() );
+   execute( TC_bank_disconnect() );
+   execute( TC_bank_disconnect_reconnect() );
 }



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17190
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: I8df29a91718b6b2829415fc040b647a58eb71292
Gerrit-Change-Number: 17190
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: remsim: More comments in RemsimClient_Tests

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17189 )


Change subject: remsim: More comments in RemsimClient_Tests
..

remsim: More comments in RemsimClient_Tests

Change-Id: I02363ee6d7b849cd2a1d2b07f1343d58c2f2
---
M remsim/RemsimClient_Tests.ttcn
1 file changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/89/17189/1

diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index d5520ab..7bee899 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -36,6 +36,7 @@
 /* ConnectClientReq from client to remsim-server */
 testcase TC_srv_connectClient() runs on client_test_CT {
f_init();
+   /* expect inbound connectClientReq */
as_connectClientReq();
setverdict(pass);
f_sleep(1.0);
@@ -44,6 +45,7 @@
 /* ConnectClientReq from client to remsim-server */
 testcase TC_srv_connectClient_reject() runs on client_test_CT {
f_init();
+   /* expect inbound connectClientReq */
as_connectClientReq(res := illegalClientId);
/* expect disconnect by client */
RSPRO_SRV[0].receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_DOWN));
@@ -55,9 +57,13 @@
 testcase TC_srv_connectClient_configClientBank() runs on client_test_CT {
var BankSlot bslot := { 1, 0 };
f_init();
+   /* expect inbound connectClientReq */
as_connectClientReq();
+   /* configure client to connect to [simulated] bankd */
f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), 
mp_bankd_port));
+   /* expect inbound connect on simulated bankd */
f_rspro_srv_exp_connect(1);
+   /* expect inbound connectClientReq on simulated bankd */
as_connectClientReq(i := 1);
setverdict(pass);
f_sleep(1.0);
@@ -67,11 +73,13 @@
 testcase TC_srv_reconnect() runs on client_test_CT {
var BankSlot bslot := { 1, 0 };
f_init();
+   /* expect inbound connectClientReq */
as_connectClientReq();

/* disconnect the client from server and expect re-establish + 
re-connect */
f_rspro_srv_fini(0);
f_rspro_srv_init(0, mp_server_ip, mp_server_port, g_srv_comp_id, 
exp_connect := true);
+   /* expect inbound connectClientReq */
as_connectClientReq(i := 0);

setverdict(pass);
@@ -82,14 +90,19 @@
 testcase TC_bank_reconnect() runs on client_test_CT {
var BankSlot bslot := { 1, 0 };
f_init();
+   /* expect inbound connectClientReq */
as_connectClientReq();
+   /* configure client to connect to [simulated] bankd */
f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), 
mp_bankd_port));
+   /* expect inbound connect on simulated bankd */
f_rspro_srv_exp_connect(1);
+   /* expect inbound connectClientReq on simulated bankd */
as_connectClientReq(i := 1);

/* disconnect the client from bankd and expect re-establish + 
re-connect */
f_rspro_srv_fini(1);
f_rspro_srv_init(1, mp_bankd_ip, mp_bankd_port, g_bankd_comp_id, 
exp_connect := true);
+   /* expect inbound connectClientReq on simulated bankd */
as_connectClientReq(i := 1);

setverdict(pass);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17189
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: I02363ee6d7b849cd2a1d2b07f1343d58c2f2
Gerrit-Change-Number: 17189
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: server: don't dereference map before OSMO_ASSERT() in _update_client_...

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17183 )

Change subject: server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()
..

server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()

Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
---
M src/server/rspro_server.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c
index 0d059fa..723aac8 100644
--- a/src/server/rspro_server.c
+++ b/src/server/rspro_server.c
@@ -219,7 +219,7 @@
 static void _update_client_for_slotmap(struct slot_mapping *map, struct 
rspro_server *srv,
struct rspro_client_conn *bankd_conn)
 {
-   struct rspro_client_conn *conn = client_conn_by_slot(srv, >client);
+   struct rspro_client_conn *conn;
char ip_str[INET6_ADDRSTRLEN];
char port_str[6];
uint32_t bankd_ip;
@@ -230,6 +230,7 @@
OSMO_ASSERT(map);
OSMO_ASSERT(srv);

+   conn = client_conn_by_slot(srv, >client);
if (!conn)
LOGP(DMAIN, LOGL_DEBUG, "%s\n", __func__);
else

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17183
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
Gerrit-Change-Number: 17183
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: server: Send ConfigClientBankReq with bankd_port == 0 on map delete

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17186 )

Change subject: server: Send ConfigClientBankReq with bankd_port == 0 on map 
delete
..

server: Send ConfigClientBankReq with bankd_port == 0 on map delete

If a slotmap is deleted via the REST API, don't only remove it from
the bankd, but also remove it from the client.

Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Closes: OS#4399
---
M src/server/rspro_server.c
1 file changed, 20 insertions(+), 13 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c
index 723aac8..b35800f 100644
--- a/src/server/rspro_server.c
+++ b/src/server/rspro_server.c
@@ -250,20 +250,25 @@
/* if caller didn't provide bankd_conn, resolve it from map */
if (!bankd_conn)
bankd_conn = bankd_conn_by_id(srv, map->bank.bank_id);
-   if (!bankd_conn)
-   return;
-
-   /* obtain IP and port of bankd */
-   rc = osmo_sock_get_ip_and_port(bankd_conn->peer->ofd.fd, ip_str, 
sizeof(ip_str),
-   port_str, sizeof(port_str), false);
-   if (rc < 0) {
-   LOGPFSM(bankd_conn->fi, "Error during getpeername\n");
-   return;
+   if (map->state == SLMAP_S_DELETING || !bankd_conn) {
+   bankd_ip = 0;
+   bankd_port = 0;
+   } else {
+   /* obtain IP and port of bankd */
+   rc = osmo_sock_get_ip_and_port(bankd_conn->peer->ofd.fd, 
ip_str, sizeof(ip_str),
+   port_str, sizeof(port_str), 
false);
+   if (rc < 0) {
+   LOGPFSM(bankd_conn->fi, "Error during getpeername\n");
+   return;
+   }
+   bankd_ip = ntohl(inet_addr(ip_str));
+   bankd_port = ; /* TODO: configurable */
}
-   bankd_ip = ntohl(inet_addr(ip_str));
-   bankd_port = ; /* TODO: configurable */
+
+   /* determine if IP/port of bankd have changed */
if (conn->client.bankd.port != bankd_port || conn->client.bankd.ip != 
bankd_ip) {
-   LOGPFSM(conn->fi, "Bankd IP/Port changed to %s:%s\n", ip_str, 
port_str);
+   struct in_addr ia = { .s_addr = bankd_ip };
+   LOGPFSM(conn->fi, "Bankd IP/Port changed to %s:%u\n", 
inet_ntoa(ia), bankd_port);
conn->client.bankd.ip = bankd_ip;
conn->client.bankd.port = bankd_port;
changed = true;
@@ -371,9 +376,11 @@
break;
}
slotmaps_unlock(slotmaps);
+   /* update client! */
+   OSMO_ASSERT(map->state == SLMAP_S_DELETING);
+   _update_client_for_slotmap(map, conn->srv, conn);
/* slotmap_del() will remove it from both global and bank list 
*/
slotmap_del(map->maps, map);
-   /* FIXME: update client! */
break;
case CLNTC_E_PUSH: /* check if any create or delete requests are 
pending */
slotmaps_wrlock(slotmaps);

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17186
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Gerrit-Change-Number: 17186
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: server: Send ConfigClientBankReq with bankd_port == 0 on map delete

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17186 )

Change subject: server: Send ConfigClientBankReq with bankd_port == 0 on map 
delete
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17186
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Gerrit-Change-Number: 17186
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:49:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: server: Send ConfigClientBankReq with bankd_port == 0 on map delete

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17186

to look at the new patch set (#3).

Change subject: server: Send ConfigClientBankReq with bankd_port == 0 on map 
delete
..

server: Send ConfigClientBankReq with bankd_port == 0 on map delete

If a slotmap is deleted via the REST API, don't only remove it from
the bankd, but also remove it from the client.

Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Closes: OS#4399
---
M src/server/rspro_server.c
1 file changed, 20 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/86/17186/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17186
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Gerrit-Change-Number: 17186
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: remsim: New TC_slotmap_del_active_client() test

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187 )

Change subject: remsim: New TC_slotmap_del_active_client() test
..

remsim: New TC_slotmap_del_active_client() test

This test verifies that a slotmap delete via REST will not only
delete it from the bankd, but also from the client.

Change-Id: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Related: OS#4399
---
M remsim/RemsimServer_Tests.ttcn
1 file changed, 54 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index f0589ef..f2dbc25 100644
--- a/remsim/RemsimServer_Tests.ttcn
+++ b/remsim/RemsimServer_Tests.ttcn
@@ -390,7 +390,7 @@
f_ensure_slotmaps({});
 }

-/* simple delete of a 'ACTIVE' slotmap */
+/* simple delete of a 'ACTIVE' slotmap from server + bankd */
 testcase TC_slotmap_del_active() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
@@ -429,6 +429,58 @@
 }


+/* simple delete of a 'ACTIVE' slotmap from client */
+testcase TC_slotmap_del_active_client() runs on test_CT {
+   var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
+   f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
+   rspro[0].rspro_bank_id := 1;
+   rspro[0].rspro_bank_nslots := 8;
+
+   rspro_id := valueof(ts_CompId(remsimClient, testcasename()));
+   f_rspro_init(rspro[1], mp_server_ip, mp_server_port, rspro_id, 1);
+   rspro[1].rspro_client_slot := valueof(ts_ClientSlot(3,4));
+
+   f_rsres_init();
+   var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(1,2), 
ts_ClientSlot(3,4)));
+   var HTTPResponse res;
+
+   /* Create a new slotmap via HTTP */
+   res := f_rsres_post_slotmap(sm);
+
+   /* verify that the slotmap exists and is NEW */
+   f_ensure_slotmap_exists_only(sm.client, sm.bank, NEW);
+
+   /* connect a bankd for that slotmap */
+   f_rspro_connect_client(0);
+
+   /* connect a client for that slotmap */
+   f_rspro_connect_client(1);
+
+   /* expect the slotmap to be pushed to bank and ACK it */
+   as_rspro_create_mapping(0, sm.client, sm.bank);
+
+   /* verify that the slotmap exists and is ACTIVE */
+   f_ensure_slotmap_exists_only(sm.client, sm.bank, ACTIVE);
+
+   /* expect the client to be configured with bankd side settings */
+   as_rspro_cfg_client_bank(1, sm.bank, ?/*FIXME*/);
+
+   f_sleep(1.0);
+
+   /* delete the slotmap via REST */
+   res := f_rsres_delete_slotmap(sm.bank);
+
+   /* verify the slotmap is gone from REST interface immediately */
+   f_ensure_slotmaps({});
+
+   /* verify the slotmap is removed from bankd */
+   as_rspro_remove_mapping(0, sm.client, sm.bank);
+
+   /* verify the slotmap is removed from client by setting IP/port to '0' 
*/
+   as_rspro_cfg_client_bank(1, ?, tr_IpPort(ts_IPv4("0.0.0.0"), 0));
+}
+
+
 /* Add a slotmap to a currently active bank */
 testcase TC_slotmap_add_active_bank() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
@@ -478,6 +530,7 @@
execute( TC_slotmap_del_new() );
execute( TC_slotmap_del_unack() );
execute( TC_slotmap_del_active() );
+   execute( TC_slotmap_del_active_client() );
execute( TC_slotmap_add_active_bank() );
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187
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: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Gerrit-Change-Number: 17187
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: remsim: New TC_slotmap_del_active_client() test

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187 )

Change subject: remsim: New TC_slotmap_del_active_client() test
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187
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: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Gerrit-Change-Number: 17187
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:48:24 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: Query + Store the USB device path

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16628 )

Change subject: remsim-client: Query + Store the USB device path
..

remsim-client: Query + Store the USB device path

While the user may have specified a USB path at the command line
(or not), let's make sure we obtain the actual path after opening
the respective USB device.

Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
---
M src/client/simtrace2-remsim_client.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index 173b890..846ce85 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -87,6 +87,7 @@
/* slot on which this card emulation instance runs */
struct st_slot *slot;
struct cardemu_usb_msg_status last_status;
+   char *usb_path;
 };

 /* global GSMTAP instance */
@@ -993,6 +994,10 @@
return;
}

+   /* (re)determine the USB path of the opened device */
+   talloc_free(ci->usb_path);
+   ci->usb_path = osmo_libusb_dev_get_path_c(ci, 
libusb_get_device(transp->usb_devh));
+
rc = libusb_claim_interface(transp->usb_devh, cfg->usb.if_num);
if (rc < 0) {
fprintf(stderr, "can't claim interface %d; rc=%d\n", 
cfg->usb.if_num, rc);

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16628
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
Gerrit-Change-Number: 16628
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: client: Add new osmo-remsim-client-shell binary

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17156 )

Change subject: client: Add new osmo-remsim-client-shell binary
..

client: Add new osmo-remsim-client-shell binary

This is a remsim-client with an interactive 'shell', where the user
can type in C-APDUs in hex formats, which will be sent to the bankd /
SIM-card.  Responses received from SIM Card via bankd will be printed
in return.

Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
---
M src/client/Makefile.am
M src/client/client.h
M src/client/remsim_client.c
M src/client/simtrace2-remsim_client.c
A src/client/user_shell.c
5 files changed, 182 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index 3d4f355..ec99818 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -4,10 +4,11 @@
$(OSMOSIMTRACE2_CFLAGS) \
-I$(top_srcdir)/include/osmocom/rspro

-bin_PROGRAMS = osmo-remsim-client-st2 remsim-client
+bin_PROGRAMS = osmo-remsim-client-st2 osmo-remsim-client-shell

-remsim_client_SOURCES = remsim_client.c ../rspro_client_fsm.c ../debug.c
-remsim_client_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \
+osmo_remsim_client_shell_SOURCES = user_shell.c \
+  remsim_client.c ../rspro_client_fsm.c 
../debug.c
+osmo_remsim_client_shell_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) 
$(OSMOABIS_LIBS) \
  $(top_builddir)/src/libosmo-rspro.la

 osmo_remsim_client_st2_SOURCES = simtrace2-remsim_client.c \
diff --git a/src/client/client.h b/src/client/client.h
index 7cc7ec1..b3001ee 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -56,3 +56,10 @@
struct client_config *cfg;
struct cardem_inst *cardem;
 };
+
+
+extern struct bankd_client *g_client;
+
+extern int client_user_bankd_handle_rx(struct rspro_server_conn *bankdc, const 
RsproPDU_t *pdu);
+
+extern int client_user_main(struct bankd_client *g_client);
diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 41361c0..dbe983b 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -52,6 +52,7 @@
break;
case RsproPDUchoice_PR_tpduCardToModem:
case RsproPDUchoice_PR_setAtrReq:
+   return client_user_bankd_handle_rx(bankdc, pdu);
default:
LOGPFSML(bankdc->fi, LOGL_ERROR, "Unknown/Unsupported RSPRO PDU 
%s\n",
 rspro_msgt_name(pdu));
@@ -61,7 +62,7 @@
return 0;
 }

-static struct bankd_client *g_client;
+struct bankd_client *g_client;
 static void *g_tall_ctx;
 void __thread *talloc_asn1_ctx;
 int asn_debug;
@@ -161,7 +162,7 @@
g_client->srv_conn.clslot = 
talloc_zero(g_client, ClientSlot_t);
g_client->srv_conn.clslot->clientId = atoi(optarg);
break;
-   case 's':
+   case 'n':
if (!g_client->srv_conn.clslot)
g_client->srv_conn.clslot = 
talloc_zero(g_client, ClientSlot_t);
g_client->srv_conn.clslot->slotNr = atoi(optarg);
@@ -185,6 +186,7 @@

g_client = talloc_zero(g_tall_ctx, struct bankd_client);

+   /* create and [attempt to] establish connection to remsim-server */
srvc = _client->srv_conn;
srvc->server_host = "localhost";
srvc->server_port = 9998;
@@ -208,6 +210,11 @@
asn_debug = 0;

bankdc = _client->bankd_conn;
+   if (srvc->clslot) {
+   bankdc->clslot = talloc_zero(g_client, ClientSlot_t);
+   *bankdc->clslot = *srvc->clslot;
+   }
+
/* server_host / server_port are configured from remsim-server */
bankdc->handle_rx = bankd_handle_rx;
memcpy(>own_comp_id, >own_comp_id, 
sizeof(bankdc->own_comp_id));
@@ -216,8 +223,7 @@
fprintf(stderr, "Unable to connect bankd conn FSM: %s\n", 
strerror(errno));
exit(1);
}
+   osmo_fsm_inst_update_id(bankdc->fi, "bankd");

-   while (1) {
-   osmo_select_main(0);
-   }
+   client_user_main(g_client);
 }
diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index ce8ea1d..bee8fc9 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -94,7 +94,7 @@
 /* global GSMTAP instance */
 static struct gsmtap_inst *g_gti;

-static struct bankd_client *g_client;
+struct bankd_client *g_client;
 static void *g_tall_ctx;
 void __thread *talloc_asn1_ctx;
 int asn_debug;
diff --git a/src/client/user_shell.c b/src/client/user_shell.c
new file mode 100644
index 000..db36aab
--- /dev/null
+++ b/src/client/user_shell.c
@@ -0,0 +1,159 @@
+#include 
+#include 
+
+#include 
+

Change in osmo-remsim[master]: client: Remove g_client completely; separate 'main' code

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17158 )

Change subject: client: Remove g_client completely; separate 'main' code
..

client: Remove g_client completely; separate 'main' code

We may want to use the entire client code independent of the current
'main' portion, so let's introduce separation via API.

Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
---
M src/client/client.h
M src/client/remsim_client.c
2 files changed, 92 insertions(+), 60 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/client/client.h b/src/client/client.h
index 0239b55..80381fa 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -61,6 +61,9 @@
 #define srvc2bankd_client(srvc)container_of(srvc, struct 
bankd_client, srv_conn)
 #define bankdc2bankd_client(bdc)   container_of(bdc, struct bankd_client, 
bankd_conn)

+struct bankd_client *remsim_client_create(void *ctx, const char *name, const 
char *software);
+void remsim_client_set_clslot(struct bankd_client *bc, int client_id, int 
slot_nr);
+

 extern int client_user_bankd_handle_rx(struct rspro_server_conn *bankdc, const 
RsproPDU_t *pdu);

diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 496e1f4..7ff8f37 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -1,4 +1,4 @@
-/* (C) 2018-2019 by Harald Welte 
+/* (C) 2018-2020 by Harald Welte 
  *
  * All Rights Reserved
  *
@@ -22,21 +22,12 @@

 #include 
 #include 
-#include 
-
-#define _GNU_SOURCE
-#include 

 #include 

-#include 
 #include 
 #include 
 #include 
-#include 
-
-#include 
-#include 

 #include "rspro_util.h"
 #include "client.h"
@@ -62,11 +53,6 @@
return 0;
 }

-static struct bankd_client *g_client;
-static void *g_tall_ctx;
-void __thread *talloc_asn1_ctx;
-int asn_debug;
-
 /* handle incoming messages from server */
 static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t 
*pdu)
 {
@@ -112,6 +98,82 @@
return 0;
 }

+struct bankd_client *remsim_client_create(void *ctx, const char *name, const 
char *software)
+{
+   struct bankd_client *bc = talloc_zero(ctx, struct bankd_client);
+   struct rspro_server_conn *srvc, *bankdc;
+   int rc;
+
+   if (!bc)
+   return NULL;
+
+   /* create and [attempt to] establish connection to remsim-server */
+   srvc = >srv_conn;
+   srvc->server_host = "localhost";
+   srvc->server_port = 9998;
+   srvc->handle_rx = srvc_handle_rx;
+   srvc->own_comp_id.type = ComponentType_remsimClient;
+   OSMO_STRLCPY_ARRAY(srvc->own_comp_id.name, name);
+   OSMO_STRLCPY_ARRAY(srvc->own_comp_id.software, software);
+   OSMO_STRLCPY_ARRAY(srvc->own_comp_id.sw_version, PACKAGE_VERSION);
+
+   rc = server_conn_fsm_alloc(bc, srvc);
+   if (rc < 0) {
+   fprintf(stderr, "Unable to create Server conn FSM: %s\n", 
strerror(errno));
+   exit(1);
+   }
+
+   bankdc = >bankd_conn;
+   /* server_host / server_port are configured from remsim-server */
+   bankdc->handle_rx = bankd_handle_rx;
+   memcpy(>own_comp_id, >own_comp_id, 
sizeof(bankdc->own_comp_id));
+   rc = server_conn_fsm_alloc(bc, bankdc);
+   if (rc < 0) {
+   fprintf(stderr, "Unable to connect bankd conn FSM: %s\n", 
strerror(errno));
+   exit(1);
+   }
+   osmo_fsm_inst_update_id(bankdc->fi, "bankd");
+
+   return bc;
+}
+
+void remsim_client_set_clslot(struct bankd_client *bc, int client_id, int 
slot_nr)
+{
+   if (!bc->srv_conn.clslot) {
+   bc->srv_conn.clslot = talloc_zero(bc, ClientSlot_t);
+   OSMO_ASSERT(bc->srv_conn.clslot);
+   }
+
+   if (!bc->bankd_conn.clslot) {
+   bc->bankd_conn.clslot = talloc_zero(bc, ClientSlot_t);
+   OSMO_ASSERT(bc->bankd_conn.clslot);
+   }
+
+   if (client_id >= 0) {
+   bc->srv_conn.clslot->clientId = client_id;
+   bc->bankd_conn.clslot->clientId = client_id;
+   }
+
+   if (slot_nr >= 0) {
+   bc->srv_conn.clslot->slotNr = slot_nr;
+   bc->bankd_conn.clslot->slotNr = slot_nr;
+   }
+}
+
+
+
+#include 
+#include 
+#define _GNU_SOURCE
+#include 
+
+#include 
+#include 
+
+static void *g_tall_ctx;
+void __thread *talloc_asn1_ctx;
+int asn_debug;
+
 static void handle_sig_usr1(int signal)
 {
OSMO_ASSERT(signal == SIGUSR1);
@@ -129,7 +191,7 @@
  );
 }

-static void handle_options(int argc, char **argv)
+static void handle_options(struct bankd_client *bc, int argc, char **argv)
 {
while (1) {
int option_index = 0, c;
@@ -153,20 +215,16 @@
exit(0);
break;
case 'i':
-   g_client->srv_conn.server_host = optarg;
+

Change in osmo-remsim[master]: client: Split into remsim_client.c and remsim_client_main.c

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17159 )

Change subject: client: Split into remsim_client.c and remsim_client_main.c
..

client: Split into remsim_client.c and remsim_client_main.c

Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
---
M src/client/Makefile.am
M src/client/remsim_client.c
A src/client/remsim_client_main.c
3 files changed, 99 insertions(+), 99 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index ec99818..ac0d707 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -6,7 +6,7 @@

 bin_PROGRAMS = osmo-remsim-client-st2 osmo-remsim-client-shell

-osmo_remsim_client_shell_SOURCES = user_shell.c \
+osmo_remsim_client_shell_SOURCES = user_shell.c remsim_client_main.c \
   remsim_client.c ../rspro_client_fsm.c 
../debug.c
 osmo_remsim_client_shell_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) 
$(OSMOABIS_LIBS) \
  $(top_builddir)/src/libosmo-rspro.la
diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 7ff8f37..07ffbde 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -159,101 +159,3 @@
bc->bankd_conn.clslot->slotNr = slot_nr;
}
 }
-
-
-
-#include 
-#include 
-#define _GNU_SOURCE
-#include 
-
-#include 
-#include 
-
-static void *g_tall_ctx;
-void __thread *talloc_asn1_ctx;
-int asn_debug;
-
-static void handle_sig_usr1(int signal)
-{
-   OSMO_ASSERT(signal == SIGUSR1);
-   talloc_report_full(g_tall_ctx, stderr);
-}
-
-static void printf_help()
-{
-   printf(
-   "  -h --help  Print this help message\n"
-   "  -i --server-ip A.B.C.D remsim-server IP address\n"
-   "  -p --server-port 13245 remsim-server TCP port\n"
-   "  -i --client-id <0-65535>   RSPRO ClientId of this client\n"
-   "  -n --client-slot <0-65535> RSPRO SlotNr of this client\n"
- );
-}
-
-static void handle_options(struct bankd_client *bc, int argc, char **argv)
-{
-   while (1) {
-   int option_index = 0, c;
-   static const struct option long_options[] = {
-   { "help", 0, 0, 'h' },
-   { "server-ip", 1, 0, 'i' },
-   { "server-port", 1, 0, 'p' },
-   { "client-id", 1, 0, 'c' },
-   { "client-slot", 1, 0, 'n' },
-   { 0, 0, 0, 0 }
-   };
-
-   c = getopt_long(argc, argv, "hi:p:c:n:",
-   long_options, _index);
-   if (c == -1)
-   break;
-
-   switch (c) {
-   case 'h':
-   printf_help();
-   exit(0);
-   break;
-   case 'i':
-   bc->srv_conn.server_host = optarg;
-   break;
-   case 'p':
-   bc->srv_conn.server_port = atoi(optarg);
-   break;
-   case 'c':
-   remsim_client_set_clslot(bc, atoi(optarg), -1);
-   break;
-   case 'n':
-   remsim_client_set_clslot(bc, -1, atoi(optarg));
-   break;
-   default:
-   break;
-   }
-   }
-}
-
-int main(int argc, char **argv)
-{
-   struct bankd_client *g_client;
-   char hostname[256];
-
-   gethostname(hostname, sizeof(hostname));
-
-   g_tall_ctx = talloc_named_const(NULL, 0, "global");
-   talloc_asn1_ctx = talloc_named_const(g_tall_ctx, 0, "asn1");
-   msgb_talloc_ctx_init(g_tall_ctx, 0);
-
-   osmo_init_logging2(g_tall_ctx, _info);
-
-   g_client = remsim_client_create(g_tall_ctx, hostname, "remsim-client");
-
-   handle_options(g_client, argc, argv);
-
-   osmo_fsm_inst_dispatch(g_client->srv_conn.fi, SRVC_E_ESTABLISH, NULL);
-
-   signal(SIGUSR1, handle_sig_usr1);
-
-   asn_debug = 0;
-
-   client_user_main(g_client);
-}
diff --git a/src/client/remsim_client_main.c b/src/client/remsim_client_main.c
new file mode 100644
index 000..95eb089
--- /dev/null
+++ b/src/client/remsim_client_main.c
@@ -0,0 +1,98 @@
+
+#include 
+#include 
+#define _GNU_SOURCE
+#include 
+
+#include 
+#include 
+
+#include "client.h"
+
+static void *g_tall_ctx;
+void __thread *talloc_asn1_ctx;
+int asn_debug;
+
+static void handle_sig_usr1(int signal)
+{
+   OSMO_ASSERT(signal == SIGUSR1);
+   talloc_report_full(g_tall_ctx, stderr);
+}
+
+static void printf_help()
+{
+   printf(
+   "  -h --help  Print this help message\n"
+   "  -i --server-ip A.B.C.D remsim-server IP 

Change in osmo-remsim[master]: client: Work without global g_client variable

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17157 )

Change subject: client: Work without global g_client variable
..

client: Work without global g_client variable

We may want to develop programs that include multiple instances of
a remsim_client.  Let's remove the global variable 'g_client' and
instead de-reference the bankd_client using container_of() macros

Change-Id: I456fb633561b88912be2f78c3e0264794d921255
---
M src/client/client.h
M src/client/remsim_client.c
M src/client/user_shell.c
3 files changed, 28 insertions(+), 21 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/client.h b/src/client/client.h
index b3001ee..0239b55 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -1,5 +1,6 @@
 #pragma once

+#include 
 #include 
 #include 
 #include 
@@ -57,8 +58,9 @@
struct cardem_inst *cardem;
 };

+#define srvc2bankd_client(srvc)container_of(srvc, struct 
bankd_client, srv_conn)
+#define bankdc2bankd_client(bdc)   container_of(bdc, struct bankd_client, 
bankd_conn)

-extern struct bankd_client *g_client;

 extern int client_user_bankd_handle_rx(struct rspro_server_conn *bankdc, const 
RsproPDU_t *pdu);

diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index dbe983b..496e1f4 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -62,7 +62,7 @@
return 0;
 }

-struct bankd_client *g_client;
+static struct bankd_client *g_client;
 static void *g_tall_ctx;
 void __thread *talloc_asn1_ctx;
 int asn_debug;
@@ -70,6 +70,7 @@
 /* handle incoming messages from server */
 static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t 
*pdu)
 {
+   struct bankd_client *bc = srvc2bankd_client(srvc);
RsproPDU_t  *resp;

switch (pdu->msg.present) {
@@ -80,24 +81,24 @@
break;
case RsproPDUchoice_PR_configClientIdReq:
/* store/set the clientID as instructed by the server */
-   if (!g_client->srv_conn.clslot)
-   g_client->srv_conn.clslot = talloc_zero(g_client, 
ClientSlot_t);
-   *g_client->srv_conn.clslot = 
pdu->msg.choice.configClientIdReq.clientSlot;
-   if (!g_client->bankd_conn.clslot)
-   g_client->bankd_conn.clslot = talloc_zero(g_client, 
ClientSlot_t);
-   *g_client->bankd_conn.clslot = *g_client->srv_conn.clslot;
+   if (!srvc->clslot)
+   srvc->clslot = talloc_zero(srvc, ClientSlot_t);
+   *srvc->clslot = pdu->msg.choice.configClientIdReq.clientSlot;
+   if (!bc->bankd_conn.clslot)
+   bc->bankd_conn.clslot = talloc_zero(bc, ClientSlot_t);
+   *bc->bankd_conn.clslot = *bc->srv_conn.clslot;
/* send response to server */
resp = rspro_gen_ConfigClientIdRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
break;
case RsproPDUchoice_PR_configClientBankReq:
/* store/set the bankd ip/port as instructed by the server */
-   osmo_talloc_replace_string(g_client, 
_client->bankd_conn.server_host,
+   osmo_talloc_replace_string(bc, >bankd_conn.server_host,
   
rspro_IpAddr2str(>msg.choice.configClientBankReq.bankd.ip));
-   rspro2bank_slot(_client->bankd_slot, 
>msg.choice.configClientBankReq.bankSlot);
-   g_client->bankd_conn.server_port = 
pdu->msg.choice.configClientBankReq.bankd.port;
+   rspro2bank_slot(>bankd_slot, 
>msg.choice.configClientBankReq.bankSlot);
+   bc->bankd_conn.server_port = 
pdu->msg.choice.configClientBankReq.bankd.port;
/* instruct bankd FSM to connect */
-   osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, 
SRVC_E_ESTABLISH, NULL);
+   osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_ESTABLISH, 
NULL);
/* send response to server */
resp = rspro_gen_ConfigClientBankRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
diff --git a/src/client/user_shell.c b/src/client/user_shell.c
index db36aab..d5cad7b 100644
--- a/src/client/user_shell.c
+++ b/src/client/user_shell.c
@@ -48,12 +48,13 @@

 int client_user_bankd_handle_rx(struct rspro_server_conn *bankdc, const 
RsproPDU_t *pdu)
 {
+   struct bankd_client *client = bankdc2bankd_client(bankdc);
switch (pdu->msg.present) {
case RsproPDUchoice_PR_tpduCardToModem:
-   bankd_handle_tpduCardToModem(g_client, pdu);
+   bankd_handle_tpduCardToModem(client, pdu);
break;
case RsproPDUchoice_PR_setAtrReq:
-   bankd_handle_setAtrReq(g_client, pdu);
+   

Change in osmo-remsim[master]: remsim-client: Fix the -k/ --keep-running option

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17188 )

Change subject: remsim-client: Fix the -k/ --keep-running option
..

remsim-client: Fix the -k/ --keep-running option

When introducing asynchronous USB support in Change-Id
Ic18690b3c2cbc5e99de0665c0b68b7555433b3cd, we accidentially
broke the --keep-running behavior, where even a disappearing USB
device will not terminate the remsim-client process.

Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d
---
M src/client/simtrace2-remsim_client.c
1 file changed, 14 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index ac78dd4..1af3274 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -96,6 +96,9 @@
 void __thread *talloc_asn1_ctx;
 int asn_debug;

+/* should we leave main loop processing? */
+bool g_leave_main = false;
+
 __attribute__((unused)) static int gsmtap_send_sim(const uint8_t *apdu, 
unsigned int len)
 {
struct gsmtap_hdr *gh;
@@ -152,10 +155,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB OUT transfer failed, status=%u\n", 
xfer->status);
+   fprintf(stderr, "USB OUT transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -577,10 +581,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB IN transfer failed, status=%u\n", xfer->status);
+   fprintf(stderr, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -627,10 +632,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB IRQ transfer failed, status=%u\n", 
xfer->status);
+   fprintf(stderr, "USB IRQ transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -1092,9 +1098,10 @@
allocate_and_submit_irq(ci);
allocate_and_submit_in(ci);

-   while (1) {
+   while (!g_leave_main) {
osmo_select_main(false);
}
+   g_leave_main = false;

libusb_release_interface(transp->usb_devh, 0);


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17188
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d
Gerrit-Change-Number: 17188
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: client: Adjust to API changes; enable build of remsim-client again

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17155 )

Change subject: client: Adjust to API changes; enable build of remsim-client 
again
..

client: Adjust to API changes; enable build of remsim-client again

There were quite a bit of API changes that hadn't yet been applied
to remsim_client.c (which was disabled and hence not compiled for
quite some time).

Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
---
M src/client/Makefile.am
M src/client/remsim_client.c
2 files changed, 22 insertions(+), 69 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index 106bc5e..3d4f355 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -4,7 +4,7 @@
$(OSMOSIMTRACE2_CFLAGS) \
-I$(top_srcdir)/include/osmocom/rspro

-bin_PROGRAMS = osmo-remsim-client-st2
+bin_PROGRAMS = osmo-remsim-client-st2 remsim-client

 remsim_client_SOURCES = remsim_client.c ../rspro_client_fsm.c ../debug.c
 remsim_client_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \
diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index ca6143e..41361c0 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -42,80 +42,25 @@
 #include "client.h"
 #include "debug.h"

-static int bankd_handle_msg(struct bankd_client *bc, struct msgb *msg)
+static int bankd_handle_rx(struct rspro_server_conn *bankdc, const RsproPDU_t 
*pdu)
 {
-   RsproPDU_t *pdu = rspro_dec_msg(msg);
-   if (!pdu) {
-   LOGPFSML(bc->bankd_fi, LOGL_ERROR, "Error decoding PDU\n");
-   return -1;
-   }
-
-   LOGPFSM(bc->bankd_fi, "Rx RSPRO %s\n", rspro_msgt_name(pdu));
-
switch (pdu->msg.present) {
case RsproPDUchoice_PR_connectClientRes:
/* Store 'identity' of bankd to in peer_comp_id */
-   rspro_comp_id_retrieve(>peer_comp_id, 
>msg.choice.connectClientRes.identity);
-   osmo_fsm_inst_dispatch(bc->bankd_fi, BDC_E_CLIENT_CONN_RES, 
pdu);
+   rspro_comp_id_retrieve(>peer_comp_id, 
>msg.choice.connectClientRes.identity);
+   osmo_fsm_inst_dispatch(bankdc->fi, SRVC_E_CLIENT_CONN_RES, 
(void *) pdu);
break;
+   case RsproPDUchoice_PR_tpduCardToModem:
+   case RsproPDUchoice_PR_setAtrReq:
default:
-   LOGPFSML(bc->bankd_fi, LOGL_ERROR, "Unknown/Unsuppoerted RSPRO 
PDU %s: %s\n",
-rspro_msgt_name(pdu), msgb_hexdump(msg));
+   LOGPFSML(bankdc->fi, LOGL_ERROR, "Unknown/Unsupported RSPRO PDU 
%s\n",
+rspro_msgt_name(pdu));
return -1;
}

return 0;
 }

-int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg)
-{
-   struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
-   struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) 
msgb_l2(msg);
-   struct bankd_client *bc = conn->data;
-   int rc;
-
-   if (msgb_length(msg) < sizeof(*hh))
-   goto invalid;
-   msg->l2h = >data[0];
-   switch (hh->proto) {
-   case IPAC_PROTO_IPACCESS:
-   rc = ipaccess_bts_handle_ccm(conn, >srv_conn.ipa_dev, msg);
-   if (rc < 0)
-   break;
-   switch (hh->data[0]) {
-   case IPAC_MSGT_PONG:
-   
ipa_keepalive_fsm_pong_received(bc->srv_conn.keepalive_fi);
-   rc = 0;
-   break;
-   default:
-   break;
-   }
-   break;
-   case IPAC_PROTO_OSMO:
-   if (!he || msgb_l2len(msg) < sizeof(*he))
-   goto invalid;
-   msg->l2h = >data[0];
-   switch (he->proto) {
-   case IPAC_PROTO_EXT_RSPRO:
-   LOGPFSML(bc->bankd_fi, LOGL_DEBUG, "Received RSPRO 
%s\n", msgb_hexdump(msg));
-   rc = bankd_handle_msg(bc, msg);
-   break;
-   default:
-   goto invalid;
-   }
-   break;
-   default:
-   goto invalid;
-   }
-
-   msgb_free(msg);
-   return rc;
-
-invalid:
-   msgb_free(msg);
-   return -1;
-}
-
 static struct bankd_client *g_client;
 static void *g_tall_ctx;
 void __thread *talloc_asn1_ctx;
@@ -137,18 +82,21 @@
if (!g_client->srv_conn.clslot)
g_client->srv_conn.clslot = talloc_zero(g_client, 
ClientSlot_t);
*g_client->srv_conn.clslot = 
pdu->msg.choice.configClientIdReq.clientSlot;
+   if (!g_client->bankd_conn.clslot)
+   g_client->bankd_conn.clslot = talloc_zero(g_client, 
ClientSlot_t);
+   *g_client->bankd_conn.clslot = 

Change in osmo-remsim[master]: remsim-client: store last 'status'

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16627 )

Change subject: remsim-client: store last 'status'
..

remsim-client: store last 'status'

Keep a local copy of the last status message of the cardem
firmware.

Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
---
M src/client/simtrace2-remsim_client.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index 515fd50..173b890 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -86,6 +86,7 @@
 struct cardem_inst {
/* slot on which this card emulation instance runs */
struct st_slot *slot;
+   struct cardemu_usb_msg_status last_status;
 };

 /* global GSMTAP instance */
@@ -544,6 +545,11 @@
-1 /* FIXME: make this 
dependent on board */);
server_conn_send_rspro(_client->bankd_conn, pdu);

+   if (ci->last_status.flags != status->flags) {
+   ci->last_status = *status;
+   } else
+   ci->last_status = *status;
+
return 0;
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16627
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
Gerrit-Change-Number: 16627
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: remsim-client: Move client_config from .c to .h file

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16626 )

Change subject: remsim-client: Move client_config from .c to .h file
..

remsim-client: Move client_config from .c to .h file

Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
---
M src/client/client.h
M src/client/simtrace2-remsim_client.c
2 files changed, 31 insertions(+), 27 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/client/client.h b/src/client/client.h
index f36e2e3..7cc7ec1 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -13,6 +13,35 @@

 struct cardem_inst;

+#define ATR_SIZE_MAX55
+struct client_config {
+   char *server_host;
+   int server_port;
+
+   int client_id;
+   int client_slot;
+
+   char *gsmtap_host;
+   bool keep_running;
+
+   char *event_script;
+
+   struct {
+   uint8_t data[ATR_SIZE_MAX];
+   uint8_t len;
+   } atr;
+
+   struct {
+   int vendor_id;
+   int product_id;
+   int config_id;
+   int if_num;
+   int altsetting;
+   int addr;
+   char *path;
+   } usb;
+};
+
 struct bankd_client {
/* connection to the remsim-server (control) */
struct rspro_server_conn srv_conn;
@@ -24,5 +53,6 @@

struct bank_slot bankd_slot;

+   struct client_config *cfg;
struct cardem_inst *cardem;
 };
diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index 190eb90..515fd50 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -844,33 +844,6 @@
);
 }

-#define ATR_SIZE_MAX55
-struct client_config {
-   char *server_host;
-   int server_port;
-
-   int client_id;
-   int client_slot;
-
-   char *gsmtap_host;
-   bool keep_running;
-
-   struct {
-   uint8_t data[ATR_SIZE_MAX];
-   uint8_t len;
-   } atr;
-
-   struct {
-   int vendor_id;
-   int product_id;
-   int config_id;
-   int if_num;
-   int altsetting;
-   int addr;
-   char *path;
-   } usb;
-};
-
 static struct client_config *client_config_init(void *ctx)
 {
struct client_config *cfg = talloc_zero(ctx, struct client_config);
@@ -1152,6 +1125,7 @@
// initialize remote SIM client

g_client = talloc_zero(g_tall_ctx, struct bankd_client);
+   g_client->cfg = cfg;
g_client->cardem = g_ci;

if (cfg->client_id != -1) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16626
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
Gerrit-Change-Number: 16626
Gerrit-PatchSet: 9
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: remsim-client: Avoid using 'ci' global variable

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16625 )

Change subject: remsim-client: Avoid using 'ci' global variable
..

remsim-client: Avoid using 'ci' global variable

Rather, pass it around between functions and attach it to other state.

Also, make it a talloc contxt so other objects can be allocated off it.

Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
---
M src/client/client.h
M src/client/simtrace2-remsim_client.c
2 files changed, 16 insertions(+), 12 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/client/client.h b/src/client/client.h
index 96a454f..f36e2e3 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -11,6 +11,8 @@

 /* main.c */

+struct cardem_inst;
+
 struct bankd_client {
/* connection to the remsim-server (control) */
struct rspro_server_conn srv_conn;
@@ -21,4 +23,6 @@
struct app_comp_id peer_comp_id;

struct bank_slot bankd_slot;
+
+   struct cardem_inst *cardem;
 };
diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index 1af3274..190eb90 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -679,17 +679,13 @@
.slot_nr = 0,
 };

-struct cardem_inst _ci = {
-   .slot = &_slot,
-};
-
-struct cardem_inst *ci = &_ci;
+static struct cardem_inst *g_ci;

 static void signal_handler(int signal)
 {
switch (signal) {
case SIGINT:
-   cardem_request_card_insert(ci, false);
+   cardem_request_card_insert(g_ci, false);
exit(0);
break;
default:
@@ -714,9 +710,9 @@
ac.sw[1] = card2modem->data.buf[card2modem->data.size - 1];
printf("SIMtrace <= SW=0x%02x%02x, len_rx=%d\n", ac.sw[0], ac.sw[1], 
card2modem->data.size - 2);
if (card2modem->data.size > 2) { // send PB and data to modem
-   cardem_request_pb_and_tx(ci, ac.hdr.ins, card2modem->data.buf, 
card2modem->data.size - 2);
+   cardem_request_pb_and_tx(bc->cardem, ac.hdr.ins, 
card2modem->data.buf, card2modem->data.size - 2);
}
-   cardem_request_sw_tx(ci, ac.sw); // send SW to modem
+   cardem_request_sw_tx(bc->cardem, ac.sw); // send SW to modem

return 0;
 }
@@ -730,7 +726,7 @@
OSMO_ASSERT(RsproPDUchoice_PR_setAtrReq == pdu->msg.present);

/* FIXME: is this permitted at any time by the SIMtrace2 
cardemfirmware? */
-   rc = cardem_request_set_atr(ci, pdu->msg.choice.setAtrReq.atr.buf,
+   rc = cardem_request_set_atr(bc->cardem, 
pdu->msg.choice.setAtrReq.atr.buf,
pdu->msg.choice.setAtrReq.atr.size);
if (rc == 0)
resp = rspro_gen_SetAtrRes(ResultCode_ok);
@@ -998,7 +994,7 @@
 }


-static void main_body(struct client_config *cfg)
+static void main_body(struct cardem_inst *ci, struct client_config *cfg)
 {
struct st_transport *transp = ci->slot->transp;
struct usb_interface_match _ifm, *ifm = &_ifm;
@@ -1125,7 +1121,10 @@
msgb_talloc_ctx_init(g_tall_ctx, 0);
osmo_init_logging2(g_tall_ctx, _info);

-   cfg = client_config_init(g_tall_ctx);
+   g_ci = talloc_zero(g_tall_ctx, struct cardem_inst);
+   g_ci->slot = &_slot;
+
+   cfg = client_config_init(g_ci);
handle_options(cfg, argc, argv);

if (cfg->usb.vendor_id < 0 || cfg->usb.product_id < 0) {
@@ -1153,6 +1152,7 @@
// initialize remote SIM client

g_client = talloc_zero(g_tall_ctx, struct bankd_client);
+   g_client->cardem = g_ci;

if (cfg->client_id != -1) {
g_client->srv_conn.clslot = talloc_zero(g_client, ClientSlot_t);
@@ -1199,7 +1199,7 @@

// connect to SIMtrace2 cardem
do {
-   main_body(cfg);
+   main_body(g_ci, cfg);
sleep(1);
} while (cfg->keep_running);


-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16625
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
Gerrit-Change-Number: 16625
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-remsim[master]: remsim-client: Call an external script in specific situations

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16629 )

Change subject: remsim-client: Call an external script in specific situations
..

remsim-client: Call an external script in specific situations

There are some situations where remsim-client would want to make its
surrounding system aware of, e.g. to take specific action.

This is particularly important on platforms where the simtrace2 firmware
doesn't have direct control over modem reset/poweron or the like.

Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Depends: libosmocore.git Ib24ac8a083db32e55402ce496a5eabd8749cc888
Closes: OS#4332
---
M doc/manuals/chapters/remsim-client.adoc
M src/client/simtrace2-remsim_client.c
2 files changed, 141 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/doc/manuals/chapters/remsim-client.adoc 
b/doc/manuals/chapters/remsim-client.adoc
index 8f90a1a..7416b05 100644
--- a/doc/manuals/chapters/remsim-client.adoc
+++ b/doc/manuals/chapters/remsim-client.adoc
@@ -82,6 +82,10 @@
   Specify the initial ATR to be communicated to the modem/phone.  Can
   and will later be overridden by the ATR as specified by
   `osmo-remsim-bankd` once a card has been mapped to this client.
+*-e, --event-script COMMAND*::
+  Specify the shell command to be execute when the client wants to call its
+  helper script
+

  Examples
 .remsim-server is on 10.2.3.4, sysmoQMOD on usb bus, all 4 modems:
@@ -97,3 +101,55 @@
 `osmo-remsim-client` currently logs to stdout only, and the logging
 verbosity is not yet configurable.  However, as the libosmocore logging
 framework is used, extending this is an easy modification.
+
+=== Helper Script
+
+`osmo-remsim-client` can call an external shell command / script / program at 
specific
+instances of time.  This serves two purposes:
+
+* To keep external system integration posted about the overall status of 
remsim-client,
+  such as whether or not it is connected to a server and/or bankd.
+* To request the external system to perform specific actions, such as 
triggering the reset
+  of the modem - in case the hardware doesn't allow the simtrace2 firmware to 
do that itself.
+
+ Script Environment Variables
+
+The environment passed to the helper script contains a number of variables to 
provide inormation
+to the external script:
+
+.Environment Variables
+[options="header",cols="27%,18%,55%"]
+|===
+| Name | Example Value | Description
+| REMSIM_CLIENT_VERSION | 0.2.2.37-5406a | Compile version of the software
+| REMSIM_SERVER_ADDR | 1.2.3.4:1234 | Address and port of the remsim-server
+| REMSIM_SERVER_STATE | CONNECTED | FSM state of the connection to 
remsim-server
+| REMSIM_BANKD_ADDR | 1.2.3.4:1234 | Address and port of the remsim-bankd
+| REMSIM_BANKD_STATE | CONNECTED | FSM state of the connection to remsim-bankd
+| REMSIM_CLIENT_SLOT | 23:42 | Client ID and Client Slot Number
+| REMSIM_BANKD_SLOT | 55:33 | Bank ID and Bank Slot Number
+| REMSIM_USB_PATH | 2-1.1 | USB path of the USB device with simtrace2 cardem 
firmware
+| REMSIM_USB_INTERFACE | 1 | Interface number of the USB device with simtrace2 
cardem firmware
+| REMSIM_SIM_VCC | 1 | Whether or not the modem currently applies SIM VCC (0/1)
+| REMSIM_SIM_RST | 1 | Whether or not the modem currently asserts SIM RST 
(0=inactive, 1=active)
+| REMSIM_CAUSE | request-card-insert | The cause why this script has been 
called
+|===
+
+ REMSIM_CAUSE values
+
+The REMSIM_CAUSE environment variable (as well as the first argument) passed 
to the helper
+script indicated why the script has been called.
+
+[options="header",cols="25%,75%"]
+|===
+| Name | Description
+| event-modem-status | The SIM card interface status has changed (e.g. VCC/RST 
change)
+| event-bankd-connect | A logical RSPRO connection to a bankd has been 
established
+| event-server-connect | A logical RSPRO connection to a server has been 
established
+| event-config-bankd | The server has instructed the client of the bankd 
address
+| request-card-insert | The client asks the system to simulate SIM card 
insertion to the modem
+| request-card-remove | The client asks the system to simulate SIM card 
removal from the modem
+| request-sim-remote | The client asks the system to switch to remote SIM
+| request-sim-local | The client asks the system to switch to local SIM
+| request-modem-reset | The client asks the system to perform a modem reset
+|===
diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index 846ce85..ce8ea1d 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -130,6 +131,77 @@
return 0;
 }

+/* build the (additional) environment for executing a script */
+static char **build_script_env(struct 

Change in osmo-remsim[master]: remsim-client: move from common 'src' directory to 'src/client'

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16623 )

Change subject: remsim-client: move from common 'src' directory to 'src/client'
..

remsim-client: move from common 'src' directory to 'src/client'

As both the bankd and the server already are in src/bankd and
src/server, respectively: Let's unify this and have the client
also in its own sub-directory.

Change-Id: I67a3a5941434f09f7099c2cdb19c126cea305a73
---
M configure.ac
M src/Makefile.am
M src/bankd/bankd.h
A src/client/Makefile.am
R src/client/client.h
R src/client/remsim_client.c
R src/client/simtrace2-remsim_client.c
M src/rspro_client_fsm.c
M src/rspro_client_fsm.h
9 files changed, 44 insertions(+), 23 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index 31af887..1c9cd72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,10 +38,6 @@
 PKG_CHECK_MODULES(OSMOCORE, libosmocore >= 1.3.0)
 PKG_CHECK_MODULES(OSMOGSM, libosmogsm >= 0.11.0)
 PKG_CHECK_MODULES(OSMOABIS, libosmoabis)
-PKG_CHECK_MODULES(OSMOSIM, libosmosim)
-PKG_CHECK_MODULES(OSMOUSB, libosmousb)
-PKG_CHECK_MODULES(OSMOSIMTRACE2, libosmo-simtrace2)
-PKG_CHECK_MODULES(USB, libusb-1.0)

 AC_ARG_ENABLE([remsim-server],[AS_HELP_STRING([--disable-remsim-server], 
[Build osmo-remsim-server])],
[osmo_ac_build_server="$enableval"],[osmo_ac_build_server="yes"])
@@ -58,11 +54,24 @@
[osmo_ac_build_bankd="$enableval"],[osmo_ac_build_bankd="yes"])
 if test "$osmo_ac_build_bankd" = "yes"; then
AC_DEFINE(BUILD_BANKD, 1, [Define if we want to build 
osmo-remsim-bankd])
+   PKG_CHECK_MODULES(OSMOSIM, libosmosim)
+   PKG_CHECK_MODULES(PCSC, libpcsclite)
 fi
 AM_CONDITIONAL(BUILD_BANKD, test "x$osmo_ac_build_bankd" = "xyes")
-   PKG_CHECK_MODULES(PCSC, libpcsclite)
 AC_SUBST(BUILD_BANKD)

+AC_ARG_ENABLE([remsim-client],[AS_HELP_STRING([--disable-remsim-client], 
[Build osmo-remsim-client])],
+   [osmo_ac_build_client="$enableval"],[osmo_ac_build_client="yes"])
+if test "$osmo_ac_build_client" = "yes"; then
+   AC_DEFINE(BUILD_CLIENT, 1, [Define if we want to build 
osmo-remsim-client])
+   PKG_CHECK_MODULES(OSMOSIM, libosmosim)
+   PKG_CHECK_MODULES(OSMOUSB, libosmousb)
+   PKG_CHECK_MODULES(OSMOSIMTRACE2, libosmo-simtrace2)
+   PKG_CHECK_MODULES(USB, libusb-1.0)
+fi
+AM_CONDITIONAL(BUILD_CLIENT, test "x$osmo_ac_build_client" = "xyes")
+AC_SUBST(BUILD_CLIENT)
+

 AC_CONFIG_MACRO_DIR([m4])

@@ -155,6 +164,7 @@
src/Makefile
src/rspro/Makefile
src/bankd/Makefile
+   src/client/Makefile
src/server/Makefile
include/Makefile
include/osmocom/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 58f02e8..c954db2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,11 +5,12 @@
 if BUILD_SERVER
 SUBDIRS += server
 endif
+if BUILD_CLIENT
+SUBDIRS += client
+endif

 AM_CFLAGS = -Wall -I$(top_srcdir)/include -I$(top_builddir)/include \
$(OSMOCORE_CFLAGS) $(OSMOGSM_CFLAGS) $(OSMOABIS_CFLAGS) \
-   $(PCSC_CFLAGS) $(USB_CFLAGS) $(OSMOSIM_CFLAGS) \
-   $(OSMOSIMTRACE2_CFLAGS) \
-I$(top_srcdir)/include/osmocom/rspro

 RSPRO_LIBVERSION=1:0:0
@@ -19,17 +20,5 @@
  rspro/libosmo-asn1-rspro.la
 libosmo_rspro_la_SOURCES = rspro_util.c asn1c_helpers.c

-noinst_HEADERS = debug.h client.h rspro_util.h slotmap.h rspro_client_fsm.h \
+noinst_HEADERS = debug.h rspro_util.h slotmap.h rspro_client_fsm.h \
 asn1c_helpers.h
-
-bin_PROGRAMS = osmo-remsim-client-st2
-
-remsim_client_SOURCES = remsim_client.c rspro_client_fsm.c debug.c
-remsim_client_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \
-libosmo-rspro.la
-
-osmo_remsim_client_st2_SOURCES = simtrace2-remsim_client.c \
-rspro_client_fsm.c debug.c
-osmo_remsim_client_st2_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) 
$(OSMOABIS_LIBS) \
-  $(OSMOUSB_LIBS) $(OSMOSIMTRACE2_LIBS) \
-  $(USB_LIBS) $(OSMOSIM_LIBS) libosmo-rspro.la
diff --git a/src/bankd/bankd.h b/src/bankd/bankd.h
index d713ed1..6de3213 100644
--- a/src/bankd/bankd.h
+++ b/src/bankd/bankd.h
@@ -14,7 +14,7 @@

 #include "rspro_util.h"
 #include "slotmap.h"
-#include "client.h"
+#include "rspro_client_fsm.h"
 #include "debug.h"

 extern struct value_string worker_state_names[];
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
new file mode 100644
index 000..106bc5e
--- /dev/null
+++ b/src/client/Makefile.am
@@ -0,0 +1,20 @@
+AM_CFLAGS = -Wall -I$(top_srcdir)/include -I/$(top_builddir)/include 
-I$(top_srcdir)/src \
+   $(OSMOCORE_CFLAGS) $(OSMOGSM_CFLAGS) $(OSMOABIS_CFLAGS) \
+   $(PCSC_CFLAGS) $(USB_CFLAGS) $(OSMOSIM_CFLAGS) \
+   $(OSMOSIMTRACE2_CFLAGS) \
+   

Change in osmo-remsim[master]: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17184 )

Change subject: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from 
RSPRO server
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17184
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
Gerrit-Change-Number: 17184
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:45:55 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: server: don't dereference map before OSMO_ASSERT() in _update_client_...

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17183 )

Change subject: server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17183
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
Gerrit-Change-Number: 17183
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:45:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: store last 'status'

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16627 )

Change subject: remsim-client: store last 'status'
..


Patch Set 8: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16627
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
Gerrit-Change-Number: 16627
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:44:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: Move client_config from .c to .h file

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16626 )

Change subject: remsim-client: Move client_config from .c to .h file
..


Patch Set 9: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16626
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
Gerrit-Change-Number: 16626
Gerrit-PatchSet: 9
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:44:32 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: Avoid using 'ci' global variable

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16625 )

Change subject: remsim-client: Avoid using 'ci' global variable
..


Patch Set 7: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16625
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
Gerrit-Change-Number: 16625
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:44:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: Fix the -k/ --keep-running option

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17188 )

Change subject: remsim-client: Fix the -k/ --keep-running option
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17188
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d
Gerrit-Change-Number: 17188
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: laforge 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:44:24 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: remsim-client: move from common 'src' directory to 'src/client'

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/16623 )

Change subject: remsim-client: move from common 'src' directory to 'src/client'
..


Patch Set 6: Code-Review+2

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16623
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I67a3a5941434f09f7099c2cdb19c126cea305a73
Gerrit-Change-Number: 16623
Gerrit-PatchSet: 6
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 14:44:13 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-remsim[master]: client: Split into remsim_client.c and remsim_client_main.c

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17159

to look at the new patch set (#3).

Change subject: client: Split into remsim_client.c and remsim_client_main.c
..

client: Split into remsim_client.c and remsim_client_main.c

Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
---
M src/client/Makefile.am
M src/client/remsim_client.c
A src/client/remsim_client_main.c
3 files changed, 99 insertions(+), 99 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/59/17159/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17159
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
Gerrit-Change-Number: 17159
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: ifd_handler (PC/SC reader driver) as remsim-client

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17160

to look at the new patch set (#3).

Change subject: client: ifd_handler (PC/SC reader driver) as remsim-client
..

client: ifd_handler (PC/SC reader driver) as remsim-client

This adds a "libifd_remsim_client.so" PC/SC driver that can be
used to make normal PC/SC client programs (like pySim, sysmo-usim-tool,
osmo-sim-test, osmo-usim-auth, ...) talk to a remote SIM bank.

Change-Id: Ib8707c6e0e46407ab39a693adfec2fa71892f6ee
---
M src/client/Makefile.am
M src/client/client.h
A src/client/user_ifdhandler.c
3 files changed, 948 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/60/17160/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17160
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib8707c6e0e46407ab39a693adfec2fa71892f6ee
Gerrit-Change-Number: 17160
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: server: Send ConfigClientBankReq with bankd_port==0 on map delete

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17186

to look at the new patch set (#2).

Change subject: server: Send ConfigClientBankReq with bankd_port==0 on map 
delete
..

server: Send ConfigClientBankReq with bankd_port==0 on map delete

If a slotmap is deleted via the REST API, don't only remove it from
the bankd, but also remove it from the client.

Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Closes: OS#4399
---
M src/server/rspro_server.c
1 file changed, 20 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/86/17186/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17186
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Gerrit-Change-Number: 17186
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Fix the -k/ --keep-running option

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17188 )


Change subject: remsim-client: Fix the -k/ --keep-running option
..

remsim-client: Fix the -k/ --keep-running option

When introducing asynchronous USB support in Change-Id
Ic18690b3c2cbc5e99de0665c0b68b7555433b3cd, we accidentially
broke the --keep-running behavior, where even a disappearing USB
device will not terminate the remsim-client process.

Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d
---
M src/client/simtrace2-remsim_client.c
1 file changed, 14 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/88/17188/1

diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index ac78dd4..1af3274 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -96,6 +96,9 @@
 void __thread *talloc_asn1_ctx;
 int asn_debug;

+/* should we leave main loop processing? */
+bool g_leave_main = false;
+
 __attribute__((unused)) static int gsmtap_send_sim(const uint8_t *apdu, 
unsigned int len)
 {
struct gsmtap_hdr *gh;
@@ -152,10 +155,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB OUT transfer failed, status=%u\n", 
xfer->status);
+   fprintf(stderr, "USB OUT transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -577,10 +581,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB IN transfer failed, status=%u\n", xfer->status);
+   fprintf(stderr, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -627,10 +632,11 @@
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "USB device disappeared\n");
-   exit(23);
+   g_leave_main = true;
break;
default:
-   osmo_panic("USB IRQ transfer failed, status=%u\n", 
xfer->status);
+   fprintf(stderr, "USB IRQ transfer failed, status=%u\n", 
xfer->status);
+   g_leave_main = true;
break;
}

@@ -1092,9 +1098,10 @@
allocate_and_submit_irq(ci);
allocate_and_submit_in(ci);

-   while (1) {
+   while (!g_leave_main) {
osmo_select_main(false);
}
+   g_leave_main = false;

libusb_release_interface(transp->usb_devh, 0);


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17188
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d
Gerrit-Change-Number: 17188
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: remsim-client: Query + Store the USB device path

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16628

to look at the new patch set (#8).

Change subject: remsim-client: Query + Store the USB device path
..

remsim-client: Query + Store the USB device path

While the user may have specified a USB path at the command line
(or not), let's make sure we obtain the actual path after opening
the respective USB device.

Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
---
M src/client/simtrace2-remsim_client.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/28/16628/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16628
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
Gerrit-Change-Number: 16628
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Adjust to API changes; enable build of remsim-client again

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17155

to look at the new patch set (#3).

Change subject: client: Adjust to API changes; enable build of remsim-client 
again
..

client: Adjust to API changes; enable build of remsim-client again

There were quite a bit of API changes that hadn't yet been applied
to remsim_client.c (which was disabled and hence not compiled for
quite some time).

Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
---
M src/client/Makefile.am
M src/client/remsim_client.c
2 files changed, 22 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/55/17155/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17155
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
Gerrit-Change-Number: 17155
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Avoid using 'ci' global variable

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16625

to look at the new patch set (#7).

Change subject: remsim-client: Avoid using 'ci' global variable
..

remsim-client: Avoid using 'ci' global variable

Rather, pass it around between functions and attach it to other state.

Also, make it a talloc contxt so other objects can be allocated off it.

Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
---
M src/client/client.h
M src/client/simtrace2-remsim_client.c
2 files changed, 16 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/25/16625/7
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16625
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
Gerrit-Change-Number: 16625
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17184

to look at the new patch set (#2).

Change subject: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from 
RSPRO server
..

rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

This is in preparation of other patches which will actually issue the
SRVC_E_DISCONNET event towards this FSM.

Related: OS#4399
Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
---
M src/rspro_client_fsm.c
M src/rspro_client_fsm.h
2 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/84/17184/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17184
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
Gerrit-Change-Number: 17184
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Work without global g_client variable

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17157

to look at the new patch set (#3).

Change subject: client: Work without global g_client variable
..

client: Work without global g_client variable

We may want to develop programs that include multiple instances of
a remsim_client.  Let's remove the global variable 'g_client' and
instead de-reference the bankd_client using container_of() macros

Change-Id: I456fb633561b88912be2f78c3e0264794d921255
---
M src/client/client.h
M src/client/remsim_client.c
M src/client/user_shell.c
3 files changed, 28 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/57/17157/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17157
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I456fb633561b88912be2f78c3e0264794d921255
Gerrit-Change-Number: 17157
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Remove g_client completely; separate 'main' code

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17158

to look at the new patch set (#4).

Change subject: client: Remove g_client completely; separate 'main' code
..

client: Remove g_client completely; separate 'main' code

We may want to use the entire client code independent of the current
'main' portion, so let's introduce separation via API.

Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
---
M src/client/client.h
M src/client/remsim_client.c
2 files changed, 92 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/58/17158/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17158
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
Gerrit-Change-Number: 17158
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Make ConfigClientBankReq with bankd_port == 0 trigger SRVC_E_...

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17185

to look at the new patch set (#2).

Change subject: client: Make ConfigClientBankReq with bankd_port == 0 trigger 
SRVC_E_DISCONNECT
..

client: Make ConfigClientBankReq with bankd_port == 0 trigger SRVC_E_DISCONNECT

If the server sends us ConfigClientBankReq with bankd_port == 0, then
this means that we shall disconnect from the bankd.  Translate this to
the SRVC_E_DISCONNECT event towards the RSPRO connection FSM.

Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Related: OS#4399
---
M src/client/remsim_client.c
M src/client/simtrace2-remsim_client.c
2 files changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/85/17185/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17185
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Gerrit-Change-Number: 17185
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: server: don't dereference map before OSMO_ASSERT() in _update_client_...

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17183

to look at the new patch set (#2).

Change subject: server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()
..

server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()

Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
---
M src/server/rspro_server.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/83/17183/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17183
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
Gerrit-Change-Number: 17183
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Call an external script in specific situations

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16629

to look at the new patch set (#8).

Change subject: remsim-client: Call an external script in specific situations
..

remsim-client: Call an external script in specific situations

There are some situations where remsim-client would want to make its
surrounding system aware of, e.g. to take specific action.

This is particularly important on platforms where the simtrace2 firmware
doesn't have direct control over modem reset/poweron or the like.

Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Depends: libosmocore.git Ib24ac8a083db32e55402ce496a5eabd8749cc888
Closes: OS#4332
---
M doc/manuals/chapters/remsim-client.adoc
M src/client/simtrace2-remsim_client.c
2 files changed, 141 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/29/16629/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16629
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Gerrit-Change-Number: 16629
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Add new osmo-remsim-client-shell binary

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17156

to look at the new patch set (#3).

Change subject: client: Add new osmo-remsim-client-shell binary
..

client: Add new osmo-remsim-client-shell binary

This is a remsim-client with an interactive 'shell', where the user
can type in C-APDUs in hex formats, which will be sent to the bankd /
SIM-card.  Responses received from SIM Card via bankd will be printed
in return.

Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
---
M src/client/Makefile.am
M src/client/client.h
M src/client/remsim_client.c
M src/client/simtrace2-remsim_client.c
A src/client/user_shell.c
5 files changed, 182 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/56/17156/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17156
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
Gerrit-Change-Number: 17156
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Move client_config from .c to .h file

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16626

to look at the new patch set (#9).

Change subject: remsim-client: Move client_config from .c to .h file
..

remsim-client: Move client_config from .c to .h file

Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
---
M src/client/client.h
M src/client/simtrace2-remsim_client.c
2 files changed, 31 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/26/16626/9
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16626
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
Gerrit-Change-Number: 16626
Gerrit-PatchSet: 9
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: store last 'status'

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16627

to look at the new patch set (#8).

Change subject: remsim-client: store last 'status'
..

remsim-client: store last 'status'

Keep a local copy of the last status message of the cardem
firmware.

Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
---
M src/client/simtrace2-remsim_client.c
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/27/16627/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16627
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
Gerrit-Change-Number: 16627
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: remsim: New TC_slotmap_del_active_client() test

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187 )


Change subject: remsim: New TC_slotmap_del_active_client() test
..

remsim: New TC_slotmap_del_active_client() test

This test verifies that a slotmap delete via REST will not only
delete it from the bankd, but also from the client.

Change-Id: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Related: OS#4399
---
M remsim/RemsimServer_Tests.ttcn
1 file changed, 54 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/87/17187/1

diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index f0589ef..f2dbc25 100644
--- a/remsim/RemsimServer_Tests.ttcn
+++ b/remsim/RemsimServer_Tests.ttcn
@@ -390,7 +390,7 @@
f_ensure_slotmaps({});
 }

-/* simple delete of a 'ACTIVE' slotmap */
+/* simple delete of a 'ACTIVE' slotmap from server + bankd */
 testcase TC_slotmap_del_active() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
@@ -429,6 +429,58 @@
 }


+/* simple delete of a 'ACTIVE' slotmap from client */
+testcase TC_slotmap_del_active_client() runs on test_CT {
+   var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
+   f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
+   rspro[0].rspro_bank_id := 1;
+   rspro[0].rspro_bank_nslots := 8;
+
+   rspro_id := valueof(ts_CompId(remsimClient, testcasename()));
+   f_rspro_init(rspro[1], mp_server_ip, mp_server_port, rspro_id, 1);
+   rspro[1].rspro_client_slot := valueof(ts_ClientSlot(3,4));
+
+   f_rsres_init();
+   var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(1,2), 
ts_ClientSlot(3,4)));
+   var HTTPResponse res;
+
+   /* Create a new slotmap via HTTP */
+   res := f_rsres_post_slotmap(sm);
+
+   /* verify that the slotmap exists and is NEW */
+   f_ensure_slotmap_exists_only(sm.client, sm.bank, NEW);
+
+   /* connect a bankd for that slotmap */
+   f_rspro_connect_client(0);
+
+   /* connect a client for that slotmap */
+   f_rspro_connect_client(1);
+
+   /* expect the slotmap to be pushed to bank and ACK it */
+   as_rspro_create_mapping(0, sm.client, sm.bank);
+
+   /* verify that the slotmap exists and is ACTIVE */
+   f_ensure_slotmap_exists_only(sm.client, sm.bank, ACTIVE);
+
+   /* expect the client to be configured with bankd side settings */
+   as_rspro_cfg_client_bank(1, sm.bank, ?/*FIXME*/);
+
+   f_sleep(1.0);
+
+   /* delete the slotmap via REST */
+   res := f_rsres_delete_slotmap(sm.bank);
+
+   /* verify the slotmap is gone from REST interface immediately */
+   f_ensure_slotmaps({});
+
+   /* verify the slotmap is removed from bankd */
+   as_rspro_remove_mapping(0, sm.client, sm.bank);
+
+   /* verify the slotmap is removed from client by setting IP/port to '0' 
*/
+   as_rspro_cfg_client_bank(1, ?, tr_IpPort(ts_IPv4("0.0.0.0"), 0));
+}
+
+
 /* Add a slotmap to a currently active bank */
 testcase TC_slotmap_add_active_bank() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, 
testcasename()));
@@ -478,6 +530,7 @@
execute( TC_slotmap_del_new() );
execute( TC_slotmap_del_unack() );
execute( TC_slotmap_del_active() );
+   execute( TC_slotmap_del_active_client() );
execute( TC_slotmap_add_active_bank() );
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17187
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: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Gerrit-Change-Number: 17187
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: client: Split into remsim_client.c and remsim_client_main.c

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17159

to look at the new patch set (#2).

Change subject: client: Split into remsim_client.c and remsim_client_main.c
..

client: Split into remsim_client.c and remsim_client_main.c

Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
---
M src/client/Makefile.am
M src/client/remsim_client.c
A src/client/remsim_client_main.c
3 files changed, 99 insertions(+), 99 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/59/17159/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17159
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
Gerrit-Change-Number: 17159
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Query + Store the USB device path

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16628

to look at the new patch set (#7).

Change subject: remsim-client: Query + Store the USB device path
..

remsim-client: Query + Store the USB device path

While the user may have specified a USB path at the command line
(or not), let's make sure we obtain the actual path after opening
the respective USB device.

Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
---
M src/client/simtrace2-remsim_client.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/28/16628/7
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16628
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
Gerrit-Change-Number: 16628
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: ifd_handler (PC/SC reader driver) as remsim-client

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17160

to look at the new patch set (#2).

Change subject: client: ifd_handler (PC/SC reader driver) as remsim-client
..

client: ifd_handler (PC/SC reader driver) as remsim-client

This adds a "libifd_remsim_client.so" PC/SC driver that can be
used to make normal PC/SC client programs (like pySim, sysmo-usim-tool,
osmo-sim-test, osmo-usim-auth, ...) talk to a remote SIM bank.

Change-Id: Ib8707c6e0e46407ab39a693adfec2fa71892f6ee
---
M src/client/Makefile.am
M src/client/client.h
A src/client/user_ifdhandler.c
3 files changed, 948 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/60/17160/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17160
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib8707c6e0e46407ab39a693adfec2fa71892f6ee
Gerrit-Change-Number: 17160
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Call an external script in specific situations

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16629

to look at the new patch set (#7).

Change subject: remsim-client: Call an external script in specific situations
..

remsim-client: Call an external script in specific situations

There are some situations where remsim-client would want to make its
surrounding system aware of, e.g. to take specific action.

This is particularly important on platforms where the simtrace2 firmware
doesn't have direct control over modem reset/poweron or the like.

Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Depends: libosmocore.git Ib24ac8a083db32e55402ce496a5eabd8749cc888
Closes: OS#4332
---
M doc/manuals/chapters/remsim-client.adoc
M src/client/simtrace2-remsim_client.c
2 files changed, 141 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/29/16629/7
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16629
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Gerrit-Change-Number: 16629
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: remsim-client: Move client_config from .c to .h file

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16626

to look at the new patch set (#8).

Change subject: remsim-client: Move client_config from .c to .h file
..

remsim-client: Move client_config from .c to .h file

Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
---
M src/client/client.h
M src/client/simtrace2-remsim_client.c
2 files changed, 31 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/26/16626/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16626
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I158fe0f2791c164adc74cf851d5a139990bce852
Gerrit-Change-Number: 16626
Gerrit-PatchSet: 8
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Adjust to API changes; enable build of remsim-client again

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17155

to look at the new patch set (#2).

Change subject: client: Adjust to API changes; enable build of remsim-client 
again
..

client: Adjust to API changes; enable build of remsim-client again

There were quite a bit of API changes that hadn't yet been applied
to remsim_client.c (which was disabled and hence not compiled for
quite some time).

Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
---
M src/client/Makefile.am
M src/client/remsim_client.c
2 files changed, 22 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/55/17155/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17155
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
Gerrit-Change-Number: 17155
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Add new osmo-remsim-client-shell binary

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17156

to look at the new patch set (#2).

Change subject: client: Add new osmo-remsim-client-shell binary
..

client: Add new osmo-remsim-client-shell binary

This is a remsim-client with an interactive 'shell', where the user
can type in C-APDUs in hex formats, which will be sent to the bankd /
SIM-card.  Responses received from SIM Card via bankd will be printed
in return.

Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
---
M src/client/Makefile.am
M src/client/client.h
M src/client/remsim_client.c
M src/client/simtrace2-remsim_client.c
A src/client/user_shell.c
5 files changed, 182 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/56/17156/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17156
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
Gerrit-Change-Number: 17156
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Work without global g_client variable

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17157

to look at the new patch set (#2).

Change subject: client: Work without global g_client variable
..

client: Work without global g_client variable

We may want to develop programs that include multiple instances of
a remsim_client.  Let's remove the global variable 'g_client' and
instead de-reference the bankd_client using container_of() macros

Change-Id: I456fb633561b88912be2f78c3e0264794d921255
---
M src/client/client.h
M src/client/remsim_client.c
M src/client/user_shell.c
3 files changed, 28 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/57/17157/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17157
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I456fb633561b88912be2f78c3e0264794d921255
Gerrit-Change-Number: 17157
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: server: Send ConfigClientBankReq with bankd_port==0 on map delete

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17186 )


Change subject: server: Send ConfigClientBankReq with bankd_port==0 on map 
delete
..

server: Send ConfigClientBankReq with bankd_port==0 on map delete

If a slotmap is deleted via the REST API, don't only remove it from
the bankd, but also remove it from the client.

Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Closes: OS#4399
---
M src/server/rspro_server.c
1 file changed, 20 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/86/17186/1

diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c
index 723aac8..b35800f 100644
--- a/src/server/rspro_server.c
+++ b/src/server/rspro_server.c
@@ -250,20 +250,25 @@
/* if caller didn't provide bankd_conn, resolve it from map */
if (!bankd_conn)
bankd_conn = bankd_conn_by_id(srv, map->bank.bank_id);
-   if (!bankd_conn)
-   return;
-
-   /* obtain IP and port of bankd */
-   rc = osmo_sock_get_ip_and_port(bankd_conn->peer->ofd.fd, ip_str, 
sizeof(ip_str),
-   port_str, sizeof(port_str), false);
-   if (rc < 0) {
-   LOGPFSM(bankd_conn->fi, "Error during getpeername\n");
-   return;
+   if (map->state == SLMAP_S_DELETING || !bankd_conn) {
+   bankd_ip = 0;
+   bankd_port = 0;
+   } else {
+   /* obtain IP and port of bankd */
+   rc = osmo_sock_get_ip_and_port(bankd_conn->peer->ofd.fd, 
ip_str, sizeof(ip_str),
+   port_str, sizeof(port_str), 
false);
+   if (rc < 0) {
+   LOGPFSM(bankd_conn->fi, "Error during getpeername\n");
+   return;
+   }
+   bankd_ip = ntohl(inet_addr(ip_str));
+   bankd_port = ; /* TODO: configurable */
}
-   bankd_ip = ntohl(inet_addr(ip_str));
-   bankd_port = ; /* TODO: configurable */
+
+   /* determine if IP/port of bankd have changed */
if (conn->client.bankd.port != bankd_port || conn->client.bankd.ip != 
bankd_ip) {
-   LOGPFSM(conn->fi, "Bankd IP/Port changed to %s:%s\n", ip_str, 
port_str);
+   struct in_addr ia = { .s_addr = bankd_ip };
+   LOGPFSM(conn->fi, "Bankd IP/Port changed to %s:%u\n", 
inet_ntoa(ia), bankd_port);
conn->client.bankd.ip = bankd_ip;
conn->client.bankd.port = bankd_port;
changed = true;
@@ -371,9 +376,11 @@
break;
}
slotmaps_unlock(slotmaps);
+   /* update client! */
+   OSMO_ASSERT(map->state == SLMAP_S_DELETING);
+   _update_client_for_slotmap(map, conn->srv, conn);
/* slotmap_del() will remove it from both global and bank list 
*/
slotmap_del(map->maps, map);
-   /* FIXME: update client! */
break;
case CLNTC_E_PUSH: /* check if any create or delete requests are 
pending */
slotmaps_wrlock(slotmaps);

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17186
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Gerrit-Change-Number: 17186
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: client: Remove g_client completely; separate 'main' code

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/17158

to look at the new patch set (#3).

Change subject: client: Remove g_client completely; separate 'main' code
..

client: Remove g_client completely; separate 'main' code

We may want to use the entire client code independent of the current
'main' portion, so let's introduce separation via API.

Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
---
M src/client/client.h
M src/client/remsim_client.c
2 files changed, 92 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/58/17158/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17158
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
Gerrit-Change-Number: 17158
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: server: don't dereference map before OSMO_ASSERT() in _update_client_...

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17183 )


Change subject: server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()
..

server: don't dereference map before OSMO_ASSERT() in 
_update_client_for_slotmap()

Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
---
M src/server/rspro_server.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/83/17183/1

diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c
index 0d059fa..723aac8 100644
--- a/src/server/rspro_server.c
+++ b/src/server/rspro_server.c
@@ -219,7 +219,7 @@
 static void _update_client_for_slotmap(struct slot_mapping *map, struct 
rspro_server *srv,
struct rspro_client_conn *bankd_conn)
 {
-   struct rspro_client_conn *conn = client_conn_by_slot(srv, >client);
+   struct rspro_client_conn *conn;
char ip_str[INET6_ADDRSTRLEN];
char port_str[6];
uint32_t bankd_ip;
@@ -230,6 +230,7 @@
OSMO_ASSERT(map);
OSMO_ASSERT(srv);

+   conn = client_conn_by_slot(srv, >client);
if (!conn)
LOGP(DMAIN, LOGL_DEBUG, "%s\n", __func__);
else

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17183
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
Gerrit-Change-Number: 17183
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17184 )


Change subject: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from 
RSPRO server
..

rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

This is in preparation of other patches which will actually issue the
SRVC_E_DISCONNET event towards this FSM.

Related: OS#4399
Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
---
M src/rspro_client_fsm.c
M src/rspro_client_fsm.h
2 files changed, 18 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/84/17184/1

diff --git a/src/rspro_client_fsm.c b/src/rspro_client_fsm.c
index d5cf04b..7df1d17 100644
--- a/src/rspro_client_fsm.c
+++ b/src/rspro_client_fsm.c
@@ -110,6 +110,7 @@

 static const struct value_string server_conn_fsm_event_names[] = {
OSMO_VALUE_STRING(SRVC_E_ESTABLISH),
+   OSMO_VALUE_STRING(SRVC_E_DISCONNECT),
OSMO_VALUE_STRING(SRVC_E_TCP_UP),
OSMO_VALUE_STRING(SRVC_E_TCP_DOWN),
OSMO_VALUE_STRING(SRVC_E_KA_TIMEOUT),
@@ -330,10 +331,26 @@

 static void srvc_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, 
void *data)
 {
+   struct rspro_server_conn *srvc = (struct rspro_server_conn *) fi->priv;
+
switch (event) {
case SRVC_E_ESTABLISH:
osmo_fsm_inst_state_chg(fi, SRVC_ST_REESTABLISH, T2_RECONNECT, 
2);
break;
+   case SRVC_E_DISCONNECT:
+   if (srvc->keepalive_fi) {
+   ipa_keepalive_fsm_stop(srvc->keepalive_fi);
+   osmo_fsm_inst_term(srvc->keepalive_fi, 
OSMO_FSM_TERM_REGULAR, NULL);
+   srvc->keepalive_fi = NULL;
+   }
+   if (srvc->conn) {
+   LOGPFSML(fi, LOGL_INFO, "Destroying existing connection 
to server\n");
+   ipa_client_conn_close(srvc->conn);
+   ipa_client_conn_destroy(srvc->conn);
+   srvc->conn = NULL;
+   }
+   osmo_fsm_inst_state_chg(fi, SRVC_ST_INIT, 0, 0);
+   break;
default:
OSMO_ASSERT(0);
}
diff --git a/src/rspro_client_fsm.h b/src/rspro_client_fsm.h
index 2f3f7fc..c1ae764 100644
--- a/src/rspro_client_fsm.h
+++ b/src/rspro_client_fsm.h
@@ -8,6 +8,7 @@

 enum server_conn_fsm_event {
SRVC_E_ESTABLISH,   /* instruct SRVC to (re)etablish TCP connection 
to bankd */
+   SRVC_E_DISCONNECT,  /* instruct SRVC to disconnect TCP connection 
to bankd */
SRVC_E_TCP_UP,
SRVC_E_TCP_DOWN,
SRVC_E_KA_TIMEOUT,

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17184
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
Gerrit-Change-Number: 17184
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-remsim[master]: remsim-client: store last 'status'

2020-02-16 Thread laforge
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-remsim/+/16627

to look at the new patch set (#7).

Change subject: remsim-client: store last 'status'
..

remsim-client: store last 'status'

Keep a local copy of the last status message of the cardem
firmware.

Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
---
M src/client/simtrace2-remsim_client.c
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/27/16627/7
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16627
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I5b348035da8f0905364b67f21f5c7be112b20e70
Gerrit-Change-Number: 16627
Gerrit-PatchSet: 7
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-remsim[master]: client: Make ConfigClientBankReq with bankd_port == 0 trigger SRVC_E_...

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/17185 )


Change subject: client: Make ConfigClientBankReq with bankd_port == 0 trigger 
SRVC_E_DISCONNECT
..

client: Make ConfigClientBankReq with bankd_port == 0 trigger SRVC_E_DISCONNECT

If the server sends us ConfigClientBankReq with bankd_port == 0, then
this means that we shall disconnect from the bankd.  Translate this to
the SRVC_E_DISCONNECT event towards the RSPRO connection FSM.

Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Related: OS#4399
---
M src/client/remsim_client.c
M src/client/simtrace2-remsim_client.c
2 files changed, 12 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/85/17185/1

diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 07ffbde..dd78c8e 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -83,8 +83,11 @@
   
rspro_IpAddr2str(>msg.choice.configClientBankReq.bankd.ip));
rspro2bank_slot(>bankd_slot, 
>msg.choice.configClientBankReq.bankSlot);
bc->bankd_conn.server_port = 
pdu->msg.choice.configClientBankReq.bankd.port;
-   /* instruct bankd FSM to connect */
-   osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_ESTABLISH, 
NULL);
+   /* bankd port 0 is a magic value to indicate "no bankd" */
+   if (bc->bankd_conn.server_port == 0)
+   osmo_fsm_inst_dispatch(bc->bankd_conn.fi, 
SRVC_E_DISCONNECT, NULL);
+   else
+   osmo_fsm_inst_dispatch(bc->bankd_conn.fi, 
SRVC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientBankRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
diff --git a/src/client/simtrace2-remsim_client.c 
b/src/client/simtrace2-remsim_client.c
index bee8fc9..2929574 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -1,4 +1,4 @@
-/* (C) 2018-2019 by Harald Welte 
+/* (C) 2018-2020 by Harald Welte 
  * (C) 2018 by sysmocom - s.f.m.c. GmbH, Author: Kevin Redon
  *
  * All Rights Reserved
@@ -874,8 +874,11 @@
   
rspro_IpAddr2str(>msg.choice.configClientBankReq.bankd.ip));
rspro2bank_slot(_client->bankd_slot, 
>msg.choice.configClientBankReq.bankSlot);
g_client->bankd_conn.server_port = 
pdu->msg.choice.configClientBankReq.bankd.port;
-   /* instruct bankd FSM to connect */
-   osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, 
SRVC_E_ESTABLISH, NULL);
+   /* bankd port 0 is a magic value to indicate "no bankd" */
+   if (g_client->bankd_conn.server_port == 0)
+   osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, 
SRVC_E_DISCONNECT, NULL);
+   else
+   osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, 
SRVC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientBankRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
@@ -901,7 +904,7 @@
 static void print_welcome(void)
 {
printf("simtrace2-remsim-client - Remote SIM card client for SIMtrace\n"
-  "(C) 2010-2019, Harald Welte \n"
+  "(C) 2010-2020, Harald Welte \n"
   "(C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 
\n\n");
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17185
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Gerrit-Change-Number: 17185
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in docker-playground[master]: update gerrit to 2.16.16

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17177 )

Change subject: update gerrit to 2.16.16
..


Patch Set 1: Verified+1 Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17177
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I20d81678a2d759bb3ac2a31945e684bf4065a8ff
Gerrit-Change-Number: 17177
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 09:50:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in docker-playground[master]: update gerrit to 2.16.16

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17177 )

Change subject: update gerrit to 2.16.16
..

update gerrit to 2.16.16

We want to stay on the 2.16.x branch so we cannot use 'lastest'

Change-Id: I20d81678a2d759bb3ac2a31945e684bf4065a8ff
---
M gerrit/Dockerfile
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved; Verified



diff --git a/gerrit/Dockerfile b/gerrit/Dockerfile
index 98599f0..af11345 100644
--- a/gerrit/Dockerfile
+++ b/gerrit/Dockerfile
@@ -1,4 +1,4 @@
-FROM gerritcodereview/gerrit
+FROM gerritcodereview/gerrit:2.16.16

 USER root
 RUN yum -y install zip unzip patch

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17177
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I20d81678a2d759bb3ac2a31945e684bf4065a8ff
Gerrit-Change-Number: 17177
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in docker-playground[master]: redmine: We no longer need the hmac diff

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17178 )

Change subject: redmine: We no longer need the hmac diff
..

redmine: We no longer need the hmac diff

The upstream redmine container/image has meanwhile upgraded to a more
recent version of the ruby base modules which don't require to be
patched anymore.

Change-Id: I0fd7684bdab55eece889a7d9e524ec2a25b30a3b
---
M redmine/Dockerfile
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved; Verified



diff --git a/redmine/Dockerfile b/redmine/Dockerfile
index 6402236..2dfb100 100644
--- a/redmine/Dockerfile
+++ b/redmine/Dockerfile
@@ -8,5 +8,6 @@
patch && \
apt-get clean

-ADDhmac.diff /tmp/hmac.diff
-RUNcd / && patch -p0 < /tmp/hmac.diff
+# no longer needed after ruby-openid-2.9.2 is used
+#ADD   hmac.diff /tmp/hmac.diff
+#RUN   cd / && patch -p0 < /tmp/hmac.diff

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17178
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0fd7684bdab55eece889a7d9e524ec2a25b30a3b
Gerrit-Change-Number: 17178
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in docker-playground[master]: redmine: We no longer need the hmac diff

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17178 )

Change subject: redmine: We no longer need the hmac diff
..


Patch Set 1: Verified+1 Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17178
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0fd7684bdab55eece889a7d9e524ec2a25b30a3b
Gerrit-Change-Number: 17178
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 09:50:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in docker-playground[master]: redmine: We no longer need the hmac diff

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17178 )


Change subject: redmine: We no longer need the hmac diff
..

redmine: We no longer need the hmac diff

The upstream redmine container/image has meanwhile upgraded to a more
recent version of the ruby base modules which don't require to be
patched anymore.

Change-Id: I0fd7684bdab55eece889a7d9e524ec2a25b30a3b
---
M redmine/Dockerfile
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/78/17178/1

diff --git a/redmine/Dockerfile b/redmine/Dockerfile
index 6402236..2dfb100 100644
--- a/redmine/Dockerfile
+++ b/redmine/Dockerfile
@@ -8,5 +8,6 @@
patch && \
apt-get clean

-ADDhmac.diff /tmp/hmac.diff
-RUNcd / && patch -p0 < /tmp/hmac.diff
+# no longer needed after ruby-openid-2.9.2 is used
+#ADD   hmac.diff /tmp/hmac.diff
+#RUN   cd / && patch -p0 < /tmp/hmac.diff

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17178
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0fd7684bdab55eece889a7d9e524ec2a25b30a3b
Gerrit-Change-Number: 17178
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in docker-playground[master]: update gerrit to 2.16.16

2020-02-16 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/17177 )


Change subject: update gerrit to 2.16.16
..

update gerrit to 2.16.16

We want to stay on the 2.16.x branch so we cannot use 'lastest'

Change-Id: I20d81678a2d759bb3ac2a31945e684bf4065a8ff
---
M gerrit/Dockerfile
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/77/17177/1

diff --git a/gerrit/Dockerfile b/gerrit/Dockerfile
index 98599f0..af11345 100644
--- a/gerrit/Dockerfile
+++ b/gerrit/Dockerfile
@@ -1,4 +1,4 @@
-FROM gerritcodereview/gerrit
+FROM gerritcodereview/gerrit:2.16.16

 USER root
 RUN yum -y install zip unzip patch

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/17177
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I20d81678a2d759bb3ac2a31945e684bf4065a8ff
Gerrit-Change-Number: 17177
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in osmo-iuh[master]: tests: Missing return statement

2020-02-16 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-iuh/+/17161 )

Change subject: tests: Missing return statement
..

tests: Missing return statement

Change-Id: I4fae9f84a83af280846b07eaa139ff4a05784a2e
---
M src/tests/hnb-test.c
M src/tests/test_common.c
2 files changed, 2 insertions(+), 1 deletion(-)

Approvals:
  fixeria: Looks good to me, approved
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index 446a14a..27959ec 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -326,7 +326,7 @@

if (len < sizeof(*ar)) {
printf("GSM48 Auth Req does not fit.\n");
-   return;
+   return -1;
}

printf(" :) Authentication Request :)\n");
diff --git a/src/tests/test_common.c b/src/tests/test_common.c
index eeb0bec..701d581 100644
--- a/src/tests/test_common.c
+++ b/src/tests/test_common.c
@@ -88,6 +88,7 @@

log_set_print_filename(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
+   return rc;
 }

 void test_common_cleanup(void)

--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/17161
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I4fae9f84a83af280846b07eaa139ff4a05784a2e
Gerrit-Change-Number: 17161
Gerrit-PatchSet: 1
Gerrit-Owner: roox 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in osmo-iuh[master]: tests: Missing return statement

2020-02-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-iuh/+/17161 )

Change subject: tests: Missing return statement
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/17161
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I4fae9f84a83af280846b07eaa139ff4a05784a2e
Gerrit-Change-Number: 17161
Gerrit-PatchSet: 1
Gerrit-Owner: roox 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sun, 16 Feb 2020 09:24:59 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment