Weird usage of gprs_ns_vty_init from gprs_bssgp_create

Holger Hans Peter Freyther hfreyther at
Sat Jun 29 07:55:12 UTC 2013

On Fri, Jun 28, 2013 at 04:52:28PM +0200, Harald Welte wrote:
> The existing libgb API should cater for that. You can very well just
> call gprs_ns_instantiate() and gprs_ns_vty_init() at PCU startup time,
> but call gprs_ns_nsip_listen() and gprs_ns_nsip_connect() at the time
> you receive the configuration from the BTS via the PCU_IF_MSG_INFO_IND.
> Wouldn't that solve the problem?


> Maybe I'm not understanding the problem yet, sorry.

the "problem" comes from the fact that in case the "BTS" exits, the next
time the BTS restarts it might gets different IP/PORT settings from
the BSC. So what was/is missing is a "gprs_ns_nsip_shutdown" which
will close the old socket and the PCU should look into destroying the
NSVC that got allocated for the old remote.

I don't know how to phrase it but I mean it nicely. Both Fairwaves
and sysmocom intend to use the PCU commercially. This means when we
wrote software we should avoid races or at least document them in a
TODO file. Because no matter how small the race, we will eventually
lose it. And the cost of understanding what went wrong is certainly
a lot higher than doing the right thing from the beginning.

I am attaching two diffs as a proposal (not even compile tested), they
should avoid the race condition.


- Holger Freyther <hfreyther at>
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gprs_ns_close.diff
Type: text/x-diff
Size: 995 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcu_initialize_vty_once.diff
Type: text/x-diff
Size: 1977 bytes
Desc: not available
URL: <>

More information about the osmocom-net-gprs mailing list