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@freyther.de:
On 29 Mar 2016, at 18:10, Вадим Яницкий axilirator@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