[PATCH] move to hex TMSI representation

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/.

Вадим Яницкий axilirator at gmail.com
Tue Mar 29 18:42:08 UTC 2016


Yes, we needn't this macro now. The only place it can be used is
vty_interface_layer3.c:

static struct gsm_subscriber *get_subscr_by_argv(struct gsm_network *gsmnet,
                         const char *type,
                         const char *id)
{
    if (!strcmp(type, "extension"))
        return subscr_get_by_extension(gsmnet->subscr_group, id);
    else if (!strcmp(type, "imsi"))
        return subscr_get_by_imsi(gsmnet->subscr_group, id);
    else if (!strcmp(type, "tmsi"))
        return subscr_get_by_tmsi(gsmnet->subscr_group, id);
    else if (!strcmp(type, "id"))
        return subscr_get_by_id(gsmnet->subscr_group, atoi(id));

    return NULL;
}

In this place we have to convert a string (written from VTY) to uint32_t
and then call the subscr_get_by_tmsi() with converted value.
User input can be unexpected, so we should check/limit the length
and check if there is '0x' sequence or not.


С наилучшими пожеланиями,
Яницкий Вадим.

2016-03-29 22:39 GMT+06:00 Holger Freyther <holger at freyther.de>:

>
> > On 29 Mar 2016, at 18:10, Вадим Яницкий <axilirator at gmail.com> wrote:
> >
> > Hello!
> >
> > > thanks a lot, I am afraid we need one more round.
> >
> > No problem :)
> >
> > > -#define tmsi_from_string(str) strtoul(str, NULL, 10)
> > > +#define tmsi_from_string(str) strtoul(str + 2, NULL, 16)
> > >
> > > this macro is used for parsing strings from the network. We should not
> modify it.
> >
> > I cannot find where...
>
>
> ah I see. You change the invocations in gsm_04_08.c. I would prefer if the
> name of this method is changed but once we work with uint32_t it will
> mostly go away anyway?
>
> holger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160330/fb79abd6/attachment.htm>


More information about the OpenBSC mailing list