HEADS UP: stricter VTY, possible config fallout

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/osmocom-net-gprs@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Sep 20 14:06:16 UTC 2017


Hi all,

we have recently merged a profound change to the inner workings of the VTY
configuration. We've hit some fallout due to that, hence I would like to let
you know that you might hit the same.

The VTY parsing of config files is now strict about indenting.
A child node *must* be indented below the parent node,
and indenting must be consistent.

For more details on the reason why and a definition of 'consistent', see the
commit log of
https://git.osmocom.org/libosmocore/commit/?id=4a31ffa2f0097d96201f80305a0495c57552f0ad


So, if you are in the near future faced with config files being rejected that
worked perfectly before, it is most probably because your indenting was wrong
all the time, and only now did we start checking it.

If the cause is hard to figure out, a good aid is the telnet VTY, where you may
either 'show running-config' or traverse the nodes manually to query which
command exists on which level. If your current config is broken, you may be
able to start the program with an empty or stripped down config file to make
its telnet available.


The above is about reading config files, but we have also dropped the implicit
'exit' to parent level on the telnet VTY console. This caused fallout where
nodes by plain omission lack the 'exit' command: one is unable to leave such a
node once it is entered. That is a fault in the program's VTY setup that was
not found before, because the VTY would often just find the parent node's exit
command instead. I have a patch to avoid all of these everywhere, by
installing the exit and end commands automatically for every VTY node that gets
created; it is not merged yet:  https://gerrit.osmocom.org/3998


------ Config Fallout Example ------

For example, we hit a breakage with this osmo-bts-trx.cfg:

phy 0
 instance 0
 osmotrx rx-gain 25
 osmotrx tx-attenuation oml
 osmotrx ip local 10.23.42.1
 osmotrx ip remote 10.23.42.2

Before, this worked perfectly. Now it says the command 'osmotrx rx-gain' does
not exist. The reason is that 'osmotrx rx-gain' is a child node of 'instance
0'.  The first fix looked like this:

phy 0
 instance 0
  osmotrx rx-gain 25
  osmotrx tx-attenuation oml
  osmotrx ip local 10.23.42.1
  osmotrx ip remote 10.23.42.2

But alas, this time it said the command 'osmotrx ip local' does not exist.  I
suspected bugs in the new parsing, but indeed, 'osmotrx ip' is actually a
direct child of the 'phy 0' level. Before, the VTY would implicitly step out of
a child level if it found a matching command one parent above. That is
confusing in other situations (see above commit log), hence we now require
indenting to clarify the structure. This is the correct one:

phy 0
 instance 0
  osmotrx rx-gain 25
  osmotrx tx-attenuation oml
 osmotrx ip local 10.23.42.1
 osmotrx ip remote 10.23.42.2

Or rephrased:

phy 0
 osmotrx ip local 10.23.42.1
 osmotrx ip remote 10.23.42.2
 instance 0
  osmotrx rx-gain 25
  osmotrx tx-attenuation oml


To query the structure via telnet, I did:

    $ ./osmo-bts/src/osmo-bts-trx/osmo-bts-trx -c osmo-bts/doc/examples/trx/osmo-bts.cfg

    $ telnet localhost 4241
    OsmoBTS> enable 
    OsmoBTS# configure terminal 
    OsmoBTS(config)# phy 0
    OsmoBTS(phy)# list
      [...]
      osmotrx ip HOST
      osmotrx ip (local|remote) A.B.C.D
      [...]
    OsmoBTS(phy)# inst
    OsmoBTS(phy)# instance 0
    OsmoBTS(phy-inst)# list
      [...]
      osmotrx rx-gain <0-50>
      osmotrx tx-attenuation <0-50>
      osmotrx tx-attenuation oml
      [...]


------ No Exit Example ------

The same osmo-trx VTY nodes also show the exit failure:

    $ telnet localhost 4241
    OsmoBTS> enable 
    OsmoBTS# configure terminal 
    OsmoBTS(config)# phy 0
    OsmoBTS(phy)# exit
    % Unknown command.
    OsmoBTS(phy)# instance 0
    OsmoBTS(phy-inst)# exit
    % Unknown command.

On the phy level, we would previously find the parent's 'exit' command, but in
the 'instance' level, 'exit' has never been available. Above patch should fix
all of these.

~N

-- 
- Neels Hofmeyr <nhofmeyr at sysmocom.de>          http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Harald Welte
-------------- 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/osmocom-net-gprs/attachments/20170920/ab25ba2a/attachment.bin>


More information about the osmocom-net-gprs mailing list