[PATCH] Add support of virtual networks for sending network name to ms depending on imsi

Ivan Kluchnikov kluchnikovi at gmail.com
Mon Apr 18 17:22:22 UTC 2016

Hi Harald,

I would prefer if we could use long-name and short-name instead of 'long
> name' and 'short name' in the VTY syntax.
> The VTY commands with spaces in them are a sign of my lack of
> understanding of the VTY system at that time.  Multiple words should
> only be used if there actually is a 'fork' in the tree, i.e. if several
> commands are possible.
> So two commands 'name short' and 'name long' would make sense, as they
> are about name, and there are two options, one for short, and one for
> long name.  Basically the same as 'name (short|long)'
> But 'short name' and 'long name' will install command nodes for 'short'
> and long', which doesn't make sense.  We keep the old syntax for
> compatibility on the 'network' node, but for new code added, we should
> try to avoid this.
> So let's either use 'name (short|long)' (maybe the best solutioin) or
> 'short-name' and 'long-name'.

Thank you for explanation.
We will have different commands for configuring the same parameters for
main network and virtual networks ("short name OpenBSC" and "name short
OpenBSC"), but I think it's ok, I will change it to 'name (short|long)'.

> > +#define IMSI_PREFIX_LENGTH 16
> we should probably not pull the magic number 16 out of our sleeve here,
> but try to use an existing #define for the length of an IMSI.  I'm quite
> sure we have one somewhere in libosmocore or the openbsc code base.

Ok, I see that GSM_IMSI_LENGTH is defined in gsm_subscriber.h, so I can
just move it to gsm_data.h and use it.
Btw, as I know maximum imsi length is 15, why 17 is used for
GSM_IMSI_LENGTH instead of 16?

> > +struct gsm_virt_network *gsm_virt_net_alloc_register(struct gsm_network
> *net)
> > +{
> > +     struct gsm_virt_network *virt_net;
> > +
> > +     virt_net = gsm_virt_net_alloc(net);
> > +     if (!virt_net)
> > +             return NULL;
> > +
> > +     virt_net->nr = net->num_virt_net++;
> > +     virt_net->network = net;
> > +     strcpy(virt_net->imsi_prefix, "00101");
> > +     virt_net->name_short = talloc_strdup(net, "OpenBSC");
> > +     virt_net->name_long = talloc_strdup(net, "OpenBSC");
> why do we have hard-coded defaults for a prefix 00101 inside the code?
> I think we should advoid such automatism, as creating a new virtual
> network will then instantaneously match 00101 prefixed IMSIs without the
> user ever specifying this. Or am I misunderstanding this?

Yes, you are right, by default imsi-prefix should be undefined, I will fix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160418/c90644a6/attachment.html>

More information about the OpenBSC mailing list