[PATCH 2/3] subscr: Make db_create_subscriber fail on duplicates

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Apr 6 10:34:50 UTC 2016


On Fri, Apr 01, 2016 at 08:33:34PM +0200, Holger Freyther wrote:
> From: Holger Hans Peter Freyther <holger at moiji-mobile.com>
> 
> The issue of db_create_subscriber updating an already existing subcr

s/subcr/subscr
;)

> is that the same subscriber will then have two entries in the active
> subscribers list. In general this will break assumptions that a subscr
> can be compared by comparing the pointer.
> 
> In the case of the VTY this was not an issue as the created subscr
> was immediately destroyed again but it is better to avoid this problem.
> 
> Change the VTY command to find the subscriber and then call sync to
> have the updated time set. The side-effect is we will now have two
> queries for the subscriber. Once through subscr_get_by_imsi and once
> through db_create_subscriber.
> 
> Change the db_create_subscriber to fail if a subscriber already exists,

  and do not update the 'updated' timestamp of an already existing
  subscriber.

  Add a testcase for this behavior.

~Neels

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160406/aaf55e4a/attachment.bin>


More information about the OpenBSC mailing list