Patch Set 1:
I have now written three proof-of-concept patches for several possible
solutions proposed by me, Harald, and Neels. All patches affect libnetif and
osmo-iuh. I don't see a way to implement a solution for this problem without
making any changes to libnetif.
Our current options are:
1) Make libnetif provide a txflush_cb callback which allows the hnbgw code to
safely close the connection after HNB-REGISTER-REJECT has been put on the Tx
queue and the Tx queue has been drained. This approach should work fine but
changes the libnetif API to a larger extent than options 2 and 3 do.
2) Set a flag in msgb->cb which causes libnetif to destroy the connection
after sending the message buffer. The hnbgw code can now destroy hnb context
state in the close_cb() callback of the connection. Care must be taken to
ensure that hnb_context_release does not call osmo_stream_srv_destroy()
recursively. We also need to verify that msg->cb is not already used for
other purposes in libnetif (this seems to be the case).
3) This works just like approach 2, except that instead of setting a flag in
the msgb control buffer we pass a message buffer of zero length to libnetif
after passing the HNB-REGISTER-REJECT message. There is the unlikely
possibility that queuing the HNB-REGISTER-REJECT message succeeds but queuing
the zero-length message fails. My proof-of-concept patch logs a warning if this
happens and relies on the other end to close the connection.
To view, visit https://gerrit.osmocom.org/6602
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperl...@sysmocom.de>