[PATCH] NAT: allow allocating BSC in arbitrary order

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Thu Apr 7 07:18:09 UTC 2016


> On 07 Apr 2016, at 01:04, Neels Hofmeyr <nhofmeyr at sysmocom.de> wrote:
> 
>> 
>> 	conf->token = talloc_strdup(conf, token);
>> -	conf->nr = nat->num_bsc;
>> +	conf->nr = number;
> 
> I think you could completely remove the num_bsc variable? It looks like its
> sole use was to determine the next available BSC number without iterating the
> list.

I have emotional attachments to this variable and would prefer to keep it around.


> 
>> +	cfg->nat->num_bsc--;
>> +	if (cfg->nat->num_bsc < 0)
>> +		LOGP(DNAT, LOGL_ERROR, "Internal error while deallocating BSC "
>> +		     "config: negative BSC index!\n");
>> }
> 
> I don't understand why you would add this check for negative BSC index.
> The llist_del() should ensure that we don't double free a BSC, right?

more like maintaining an invariant. So maybe OSMO_ASSERT(num_bsc >= 0) is better?


> Also nice would be to add a test case that has a non-null BSC number, to show
> that having gaps in the numbering doesn't have side effects.


Do you have an idea for the testcase?

holger




More information about the OpenBSC mailing list