<p>neels <strong>uploaded patch set #12</strong> to this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-hlr/+/16205">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">refactor: add and use lu_fsm, osmo_gsup_req, osmo_gt<br><br>These are seemingly orthogonal changes in one patch, because they are in fact<br>sufficiently intertwined that we are not willing to spend the time to separate<br>them. They are also refactoring changes, unlikely to make sense on their own.<br><br>** lu_fsm:<br><br>Attempting to make luop.c keep state about incoming GSUP requests made me find<br>shortcomings in several places:<br>- since it predates osmo_fsm, it is a state machine that does not strictly<br>  enforce the order of state transitions or the right sequence of incoming<br>  events.<br>- several places OSMO_ASSERT() on data received from the network.<br>- modifies the subscriber state before a LU is accepted.<br>- dead code about canceling a subscriber in a previous VLR. That would be a<br>  good thing to actually do, which should also be trivial now that we record<br>  vlr_name and sgsn_name, but I decided to remove the dead code for now.<br><br>To both step up the LU game *and* make it easier for me to integrate<br>osmo_gsup_req handling, I decided to create a lu_fsm, drawing from my, by now,<br>ample experience of writing osmo_fsms.<br><br>** osmo_gsup_req:<br><br>Prepare for D-GSM, where osmo-hlr will do proxy routing for remote HLRs /<br>communicate with remote MSCs via a proxy:<br><br>a) It is important that a response that osmo-hlr generates and that is sent<br>back to a requesting MSC contains all IEs that are needed to route it back to<br>the requester. Particularly source_name must become destination_name in the<br>response to be able to even reach the requesting MSC. Other fields are also<br>necessary to match, which were so far taken care of in individual numerous code<br>paths.<br><br>b) For some operations, the response to a GSUP request is generated<br>asynchronously (like Update Location Request -> Response, or taking the<br>response from an EUSE, or the upcoming proxying to a remote HLR). To be able to<br>feed a request message's information back into the response, we must thus keep<br>the request data around. Since struct osmo_gsup_message references a lot of<br>external data, usually with pointers directly into the received msgb, it is not<br>so trivial to pass GSUP message data around asynchronously, on its own.<br><br>osmo_gsup_req is the combined solution for both a and b: it keeps all data for<br>a GSUP message by taking ownership of the incoming msgb, and it provides an<br>explicit API "forcing" callers to respond with osmo_gsup_req_respond(), so that<br>all code paths trivially are definitely responding with the correct IEs set to<br>match the request's routing (by using osmo_gsup_make_response() recently added<br>to libosmocore).<br><br>Adjust all osmo-hlr code paths to use *only* osmo_gsup_req to respond to<br>incoming requests received on the GSUP server (above LU code being one of<br>them).<br><br>In fact, the same should be done on the client side. Hence osmo_gsup_req is<br>implemented in a server/client agnostic way, and is placed in<br>libosmo-gsupclient. As soon as we see routing errors in complex GSUP setups,<br>using osmo_gsup_req in the related GSUP client is likely to resolve those<br>problems without much thinking required beyond making all code paths use it.<br><br>libosmo-gsupclient is hence added to osmo-hlr binary's own library<br>dependencies. It would have been added by the D-GSM proxy routing anyway, we<br>are just doing it a little sooner.<br><br>** global_title.c / osmo_gt:<br><br>We so far handle a Global Title a.k.a. an IPA unit name as pointer + size, or<br>as just pointer with implicit talloc size. To ease working with GSUP peer<br>identification data, I require:<br><br>- a non-allocated storage of a Global Title. It brings the drawback of being<br>  size limited, but our current implementation is anyway only able to handle<br>  MSC and SGSN names of 31 characters (see struct hlr_subscriber).<br>- a single-argument handle for Global Title,<br>- easy to use utility functions like osmo_gt_name(), osmo_gt_cmp(), and copying<br>  by simple assignment, a = b.<br><br>Hence this patch adds a osmo_gt in global_title.h and global_title.c. Heavily<br>used in LU and osmo_gsup_req.<br><br>Depends: libosmocore Id9692880079ea0f219f52d81b1923a76fc640566<br>Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9<br>---<br>M include/Makefile.am<br>A include/osmocom/gsupclient/global_title.h<br>A include/osmocom/gsupclient/gsup_req.h<br>M include/osmocom/hlr/Makefile.am<br>M include/osmocom/hlr/db.h<br>M include/osmocom/hlr/gsup_router.h<br>M include/osmocom/hlr/gsup_server.h<br>M include/osmocom/hlr/hlr.h<br>M include/osmocom/hlr/hlr_ussd.h<br>M include/osmocom/hlr/logging.h<br>A include/osmocom/hlr/lu_fsm.h<br>D include/osmocom/hlr/luop.h<br>M src/Makefile.am<br>M src/db.c<br>M src/db_hlr.c<br>M src/gsup_router.c<br>M src/gsup_send.c<br>M src/gsup_server.c<br>M src/gsupclient/Makefile.am<br>A src/gsupclient/global_title.c<br>M src/gsupclient/gsup_client.c<br>A src/gsupclient/gsup_req.c<br>M src/hlr.c<br>M src/hlr_ussd.c<br>M src/logging.c<br>A src/lu_fsm.c<br>D src/luop.c<br>M tests/db/Makefile.am<br>M tests/db/db_test.c<br>M tests/db/db_test.err<br>M tests/gsup_server/Makefile.am<br>M tests/test_nodes.vty<br>32 files changed, 1,225 insertions(+), 904 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/05/16205/12</pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-hlr/+/16205">change 16205</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-hlr/+/16205"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9 </div>
<div style="display:none"> Gerrit-Change-Number: 16205 </div>
<div style="display:none"> Gerrit-PatchSet: 12 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>