Attention is currently required from: Hoernchen, daniel, dexter, laforge.
Hello Jenkins Builder, daniel, dexter, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/43545?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed: Code-Review+1 by laforge, Verified-1 by Jenkins Builder
Change subject: smpp2sim: make the SCP81 BIP relay work ......................................................................
smpp2sim: make the SCP81 BIP relay work
The BIP relay ( the "handset" side for SCP81) never worked: the connect callback in handle_OpenChannel was "never called" as the fixme says, everything else was missing.
Fixme cause: card APDU I/O is driven synchronously, proactive command loop lives in a blocking while loop (pySim.transport.LinkBase.send_apdu_checksw) that runs on the Twisted reactor thread. A Twisted TCP4ClientEndpoint + connectProtocol only completes when the reactor does reactor things, but the reactor thread is stuck in that loop for the whole proactive session...
Fixme fix: don't fight the reactor, just drive the relay channel with a plain old blocking socket, which fits the synchronous execution model. Channel numbers now come from the command Device identities (channel_N -> low nibble) instead of the hard coded chan_nr == 1.
Additionally fix two bugs found on the path to scp81 glory: - TERMINAL RESPONSE device identities are forced to terminal->UICC per TS 102 223 6.8.2 (prepare_response() inverts the command identities, which for a channel-addressed BIP command yields channel_N->UICC). - Error responses now build a valid AddlInfoBip cause, prepare_response() hard coded empty "additional information" cannot be encoded for a BIP error.
And some tests based on real card interactions.
Change-Id: If96c768f2e35c20ea3753e601059410121517b60 --- M pySim-smpp2sim.py M pySim/bip.py M tests/unittests/test_bip_relay.py 3 files changed, 539 insertions(+), 41 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/45/43545/2