Update - I've created a better tunnel via ssh port forwarding (why did
I ever bother with netcat?), to bypass the connection problem:

root@rpi-cardem-2:~# ssh -L 9999:remsim-server:9999 pi@remsim-server

Starting the client now shows other repeating messages I need to figure out:
root@rpi-cardem-2:~# osmo-remsim-client-st2 --server-ip remsim-server
--server-port 9998 --client-id 1 --client-slot 1 --usb-vendor 1d50
--usb-product 60e3 --usb-config 1 --usb-interface 0 --usb-path "1-1.4"
DRSPRO INFO ../rspro_client_fsm.c:307
RSPRO_CLIENT(server){REESTABLISH}: Creating TCP connection to server
at remsim-server:9998
DLINP NOTICE simtrace2_api.c:271 [0] <=
osmo_st2_cardem_request_config(features=00000001)
DLINP NOTICE input/ipa.c:141 remsim-server:9998 connection done
DRSPRO NOTICE ../rspro_client_fsm.c:127
RSPRO_CLIENT(server){REESTABLISH}: RSPRO link to remsim-server:9998 UP
DRSPRO INFO ../rspro_client_fsm.c:307
RSPRO_CLIENT(bankd){REESTABLISH}: Creating TCP connection to server at
127.0.0.1:9999
DLINP NOTICE input/ipa.c:141 127.0.0.1:9999 connection done
DRSPRO NOTICE ../rspro_client_fsm.c:127
RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 127.0.0.1:9999 UP
DRSPRO ERROR ../rspro_client_fsm.c:297
RSPRO_CLIENT(bankd){REESTABLISH}: Event SRVC_E_KA_TERMINATED not
permitted
DRSPRO INFO ../rspro_client_fsm.c:302
RSPRO_CLIENT(bankd){REESTABLISH}: Destroying existing connection to
server
DRSPRO INFO ../rspro_client_fsm.c:307
RSPRO_CLIENT(bankd){REESTABLISH}: Creating TCP connection to server at
127.0.0.1:9999
DLINP NOTICE input/ipa.c:141 127.0.0.1:9999 connection done
DRSPRO NOTICE ../rspro_client_fsm.c:127
RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 127.0.0.1:9999 UP
DRSPRO ERROR ../rspro_client_fsm.c:297
RSPRO_CLIENT(bankd){REESTABLISH}: Event SRVC_E_KA_TERMINATED not
permitted

The bankd daemon says:
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 526 DBANKDW INFO
bankd_main.c:442 [003 CONN_CLIENT_MAPPED] Changing state to ACCEPTING
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:955 [000 ACCEPTING] Accepted connection from
127.0.0.1:57908
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:442 [000 ACCEPTING] Changing state to CONN_WAIT_ID
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:655 [000 CONN_WAIT_ID] Rx RSPRO connectClientReq(T=0,
N='rpi-cardem-2', SW='remsim-client', VER='1.0.0')
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:442 [000 CONN_WAIT_ID] Changing state to CONN_CLIENT
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:625 [000 CONN_CLIENT] slotmap found: C(1:1) -> B(1:1)
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:450 [000 CONN_CLIENT] Changing state to
CONN_CLIENT_MAPPED (timeout=10)
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_pcsc.c:261 [000 CONN_CLIENT_MAPPED] Attempting to open PC/SC
context
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_pcsc.c:264 [000 CONN_CLIENT_MAPPED] SCardEstablishContext: OK
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_pcsc.c:215 [000 CONN_CLIENT_MAPPED] Attempting to find card/slot
using regex 'SCM Microsystems Inc. SCR 3310 [CCID Interface]
(53312144266274) 00 00'
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:967 [000 CONN_CLIENT_MAPPED] Error -2 occurred: Cleaning
up state
Jul 08 10:27:00 rpi-cardem-1 osmo-remsim-bankd[405]: 522 DBANKDW INFO
bankd_main.c:442 [000 CONN_CLIENT_MAPPED] Changing state to ACCEPTING


Does this mean that it doesn't find the reader? Though the name is the
one reported by pcsc_scan:
root@rpi-cardem-1:~# pcsc_scan | head
Using reader plug'n play mechanism
Scanning present readers...
0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00

Sat Jul  8 10:30:44 2023
 Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface]
(53312144266274) 00 00
  Event number: 0
  Card state: Card inserted,
  ATR: 3B 9F 96 80 1F C7 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01 54
ATR: 3B 9F 96 80 1F C7 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01 54


Or is this a consequence of my port forwarding attempt?
Thanks!

On Sat, Jul 8, 2023 at 12:12 PM Adrian Popa <adrian.popa...@gmail.com> wrote:
>
> Hello everyone!
> I'm new to simtrace and I'm trying to set up a test with a Simtrace2
> board connected to a RPI (which I'll call the client from now on) and
> a different RPI with an attached card reader (which I'll call the
> server).
>
> The server runs osmo-remsim-bankd and osmo-remsim-server (installed
> from your debian repo). The bankd server has its configuration csv
> file filled with the correct reader information. The
> osmo-remsim-server runs on the same machine and has a mapping
> configured via the python api tool to map client 1 to bank 1, like so:
>
> root@rpi-cardem-1:~# python3 /etc/osmocom/osmo-remsim-apitool -a
> /clients: {'clients': []}
> /banks: {'banks': [{'peer': 'B1', 'state': 'CONNECTED_BANKD',
> 'component_id': {'type_': 'remsimBankd', 'name': 'fixme-name',
> 'software': 'remsim-bankd', 'swVersion': '1.0.0'}, 'bankId': 1,
> 'numberOfSlots': 5}]}
> /slotmaps: {'slotmaps': [{'bank': {'bankId': 1, 'slotNr': 1},
> 'client': {'clientId': 1, 'slotNr': 1}, 'state': 'ACTIVE'}]}
>
> The client runs osmo-remsim-client-st2 like this:
> root@rpi-cardem-2:~# osmo-remsim-client-st2 --server-ip remsim-server
> --server-port 9998 --client-id 1 --client-slot 1 --usb-vendor 1d50
> --usb-product 60e3 --usb-config 1 --usb-interface 0 --usb-path "1-1.4"
>
> However, based on the logs, it tries to contact the bankd server at
> 127.0.0.1:9999 instead of remsim-server:9999:
>
> DRSPRO INFO ../rspro_client_fsm.c:307
> RSPRO_CLIENT(server){REESTABLISH}: Creating TCP connection to server
> at remsim-server:9998
> DLINP NOTICE simtrace2_api.c:271 [0] <=
> osmo_st2_cardem_request_config(features=00000001)
> DLINP NOTICE input/ipa.c:141 remsim-server:9998 connection done
> DRSPRO NOTICE ../rspro_client_fsm.c:127
> RSPRO_CLIENT(server){REESTABLISH}: RSPRO link to remsim-server:9998 UP
> DRSPRO INFO ../rspro_client_fsm.c:307
> RSPRO_CLIENT(bankd){REESTABLISH}: Creating TCP connection to server at
> 127.0.0.1:9999
> DRSPRO NOTICE ../rspro_client_fsm.c:127
> RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 127.0.0.1:9999 DOWN
>
> The bankd server listens on 0.0.0.0 on the server side:
> root@rpi-cardem-1:~# netstat -tpan | grep osmo | grep LISTEN
> tcp        0      0 0.0.0.0:9997            0.0.0.0:*
> LISTEN      409/osmo-remsim-ser
> tcp        0      0 0.0.0.0:9998            0.0.0.0:*
> LISTEN      409/osmo-remsim-ser
> tcp        0      0 0.0.0.0:9999            0.0.0.0:*
> LISTEN      405/osmo-remsim-ban
>
> My question is - how is osmo-remsim-client-st2 getting the IP address
> of the bankd server? What did I do wrong?
>
> I've tried a few tricks to redirect traffic from 127.0.0.1:9999 to
> remsim-server:9999, but so far have failed. This is what I've tried as
> a proxy, but the connection seems to get garbled because netcat
> expects LF terminated strings:
> nc -l 127.0.0.1 9999 | nc remsim-server 9999
>
> Thanks for the help
> Cheers,
> Adrian

Reply via email to