| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Callers require to know whether the returned ERROR cmd was received or
generated locally, in order to send it or do something with it locally.
Related: OS#3394
Change-Id: Ide9170e5c31967c353f8fe4e8227e64130b91eae
|
|
|
|
| |
Change-Id: I46a1cef3013c9bbf9b5a6d64e83cd84568f2523c
|
|
|
|
|
| |
Closes: OS#3293
Change-Id: I8dc2f24d4bf557ff7bb0f2f46881f9f8d9d7f86f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The CTRL interface has a ctrl_cmd_def_* API that allows deferring a CTRL
command reply until later. However, the command handling currently fails to
acknowledge this and deallocates the struct ctrl_cmd anyway.
Fix: in struct ctrl_cmd, add a defer pointer to be populated by
ctrl_cmd_def_make(). A cmd thus marked as deferred is not deallocated at the
end of command handling. This fix needs no change in calling code.
(Another idea was to return a different code than CTRL_CMD_HANDLED when the
command is to be deferred, but that would require adjusting each user of
ctrl_cmd_def_make(). The implicit marking is safer and easier.)
Show that handling deferred commands is fixed by adjusting the expectations of
ctrl_test.c's test_deferred_cmd() and removing the now obsolete exit_early
label.
One symptom of the breakage is that osmo-bts-sysmo crashes when asked to report
a trx's clock-info, which is aggravated by the fact that the sysmobts-mgr does
ask osmo-bts-sysmo for a clock-info.
The crash appears since Id583b413f8b8bd16e5cf92a8a9e8663903646381 -- it looked
like just fixing an obvious memory leak, which it did as shown by the unit
test, but deferred ctrl commands actually relied on that leak. Both fixed now.
Related: OS#3120
Change-Id: I24232be7dcf7be79f4def91ddc8b8f8005b56318
|
|
|
|
| |
Change-Id: Ib79cdb62d45d8c78445c7b064e58eb7e9faeccf9
|
|
|
|
|
|
|
|
|
| |
So far it uses 2323, a development default. Instead, assign new ports,
appending to the common range of VTY and CTRL ports: 4261 and 4262.
Related: https://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers
Related: I28bd7a97d24455f88fadc6724d45c3264ba2fce4 (osmo-gsm-manuals)
Change-Id: Ife52a968a41cb286f640006587877971ff66c1a4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a control command fails to parse, we so far discard specific error messages
and instead send just "Command parser error".
In ctrl_cmd_parse() we actually compose detailed error replies, but in the end
simply talloc_free() them and return NULL.
A first step to report these errors to the ctrl command issuer is to not return
NULL and instead return the cmd with type = CTRL_TYPE_ERROR. Add
ctrl_cmd_parse2() to return such instead of NULL.
To stay API compatible, provide ctrl_cmd_parse2() to return a cmd on errors.
ctrl_cmd_parse() retains identical behavior but becomes just a simple wrapper
around ctrl_cmd_parse2() which discards the cmd on error.
No need really to deprecate ctrl_cmd_parse() yet; especially as long as
compiler warnings might break jenkins builds.
Change-Id: I5047c9f977d70b03eea77cbcfd2b96d43ea46880
|
|
|
|
|
|
|
|
|
|
| |
In order to allow unit testing the ctrl iface msgb handling, have a separate
msgb entry point function from the actual fd read function.
An upcoming patch will prove a memory leak in CTRL msgb handling by a unit test
that needs this separation.
Change-Id: Ie09e39db668b866eeb80399b82e7b04b8f5ad7c3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add macro to append to a CTRL commands' reply string, ctrl_cmd_reply_printf().
The talloc_asprintf() part of it is generic enough to qualify for a separate
macro, osmo_talloc_asprintf().
The idea is to not have to decide for each bit added to a string whether the
string is already allocated or not, but simply be able to issue printf commands
and let the macro worry about initial allocation or reallocation.
This originally came from osmo-hlr change
I1bd62ae0d4eefde7e1517db15a2155640a1bab58, where it was requested to move this
bit to libosmocore.
Change-Id: Ic9dba0e4a1eb5a7dc3cee2f181b9024ed4fc7005
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add ctrl_interface_setup_dynip2() to add a node_count parameter, which can be
used to define more ctrl nodes without having to merge a patch to libosmocore.
In consequence, also add ctrl_handle_alloc2(), since
ctrl_interface_setup_dynip() uses ctrl_handle_alloc() to allocate the node
slots, and add node_count param to static ctrl_init().
Passing zero as node_count indicates to use the default of _LAST_CTRL_NODE as
before, i.e. to not define more ctrl nodes. Assert that we never allocate less
than _LAST_CTRL_NODE slots.
The current ctrl_interface_setup_dynip() and ctrl_handle_alloc() become simple
wrappers that pass zero as node_count. Their use is still valid and they do not
need to be deprecated.
The API comment to ctrl_interface_setup_dynip2() explains how to define more
node IDs.
This patch was verified to work by osmo-hlr.git change
I98ee6a06b3aa6a67adb868e0b63b0e04eb42eb50 which adds two node IDs for use by
osmo-hlr only.
Change-Id: I1bd62ae0d4eefde7e1517db15a2155640a1bab58
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.
Many files now show a short description in the generated API doc that was so
far only available as C comment.
The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation
In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).
Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
|
|
|
|
|
|
|
|
|
| |
This allows programmatic access to introspection of FSM instances, which
is quite handy from e.g. external test cases: Send a message to the
code, then use the CTRL interface to check if that message has triggered
the right kind of state transition.
Change-Id: I0f80340ee9c61c88962fdd6764a6098a844d0d1e
|
|
|
|
|
|
|
|
| |
Sometimes (particularly when testing), we may want to parse+execute an
arbitrary control command simply form a string buffer, rather than from
a msgb. Let's add a helper for that.
Change-Id: Iaca748e0d942bb2a1ee7c2776b37485e1439eb0c
|
|
|
|
|
|
|
| |
When executing test cases, we don't want to bind to a local TCP port, as
we cannot make assumptions as to which ports are actually free.
Change-Id: I5717f9dd92d1f143f069cecd4b4c8ba3d03b25f8
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing code assumes that the main application knows about all
control command nodes and can thus present one lookup function.
As libraries are getting their own control interface handling, this
is too restrictive, and we need a way how library code can dynamically
register more node lookup helpers. We can now do this by means of a
ctrl_lookup_register() function.
Change-Id: Ib69908d1c57f5bb721d5496e3b4a5258fca450e3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more
obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN.
No other value_string[]s to date have such a "hidden" terminator.
BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can
set a string for CTRL_TYPE_UNKNOWN == 0.
Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all
code paths explicitly check for the CTRL_TYPE_*s that are valid.
Adjust the test expectation.
From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0
anyway.
One motivation to press this fixup: I am trying to add a script that checks
whether all value_string[]s are terminated to our jenkins jobs, and to find
that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN
constant, which would make things far more complex. At this point, all of the
value_string[]s have an explicit termination, and I would like to enforce this
from now on -- for readable code and to not spend more time on the validator.
The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was
accepted by another reviewer before I could reconfirm my -1, so this is a fixup
to enable the termination checking script patches.
Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore)
I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh)
Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals)
Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc
|
|
|
|
|
|
|
|
| |
Use value_string for enum ctrl_type instead of custom code. Add
corresponding unit tests.
Related: OS#1615
Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
|
|
|
|
|
|
| |
See OS#1958
Change-Id: I85aee0f8fdfc9c69d0ba9240988c633d3e707f2d
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add function for allocating CTRL connection to public headers and
replace call to previous static function with it. Add doxygen docs for
this function.
It's useful if we need to allocate ctrl connection but don't need to
bind to any interfaces: when we act as ctrl client.
Related: OS#1615
Change-Id: I522ed809cbebfd3d7dd08b4ed9137b39ff192e32
|
|
|
|
|
| |
Change-Id: I1328c89ec8e908bf4b4d2c0a398690278369e0f5
Related: OS#1645
|
|
|
|
|
|
|
| |
It is still too easy to forget syncing, so add another reminder at the end
of the list.
Change-Id: I95191906afa8e6ada31310d0e36de33e3fccf268
|
|
|
|
|
|
|
|
|
| |
Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which
are not meant to be read, only to set. Similarly, add
CTRL_CMD_DEFINE_WO_NOVRF() for commands which do not perform inbound
data verification.
Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit ed9d6da5df98538adc70aa03cb569eb9505d04b6.
The commit is good as such, but it causes many compiler warnings in the OpenBSC
build. We want this to be re-applied as soon as we have patches ready that fix
the fallout in openbsc.git.
See also https://lists.osmocom.org/pipermail/openbsc/2016-October/009802.html
Related: OS#1829
Change-Id: I722ad60232a6ef5b4cb984b92c42851de26b3ccd
|
|
|
|
|
| |
Change-Id: Ic0b8d88c4f5c4d42c3f8fb754f8eabf049c9e388
Related: OS#1646
|
|
|
|
| |
Change-Id: I3f55c1d4b965d215dc9b16f4b284b7fea4bde9e9
|
|
|
|
|
|
|
| |
4253 used to collide with the sysmobts-mgr VTY port.
Note, openggsn does not actually have a Ctrl interface yet.
Change-Id: If0fa0e606dabd5bc89907a56ef18cdbbbdedb4b7
|
|
|
|
| |
Change-Id: I6a7bf04e589ccfaea98f20900a9bfe9dd4808dce
|
|
|
|
|
| |
Change-Id: Ie7232189fe3265a8631fd3652b2c8c152cdee918
Related: OS#1646
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This may seem like overkill for a mere const char * config item, but it makes
the Control interface VTY commands reusable in any main() scope (inspired by
libosmo-abis' VTY config).
Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files
src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or
installed dependent on ENABLE_VTY.
Using these functions allows configuring a static const char* with the VTY
commands
ctrl
bind A.B.C.D
which callers shall subsequently use to bind the Control interface to a
specific local interface address, by passing the return value of
ctrl_vty_get_bind_addr() to control_interface_setup().
Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment
on avoiding ABI changes.
|
|
|
|
|
|
| |
Make the ctrl interface bind address configurable, so that it may be made
available on other addresses than 127.0.0.1. The specific aim is to allow
running multiple osmo-nitbs alongside each other (commits in openbsc follow).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes a control interface command cannot be processed
and responded immediately, but we need to process it asynchronously.
In order to support this, we introduce the 'ctrl_cmd_def', which
represents such a deferred command. It is created by the service
implementing the command using ctrl_cmd_def_make(), and a response is
later sent using ctrl_cmd_def_send().
ctrl_cmd_def_is_zombie() must be called to handle the case where
the control connection has disconnected/died between receiving the
command and sending the response.
|
| |
|
| |
|
|
|
|
|
| |
which means that all control interface related functions now have
the common ctrl_ prefix.
|
|
|
|
|
|
| |
The control interface user now only has to register a very short
node lookup function callback. This function is optional, and only
required if hierarchical command lookup should be supported.
|
|
|
|
|
| |
libctrl doesn't need any knowledge about the type of the user-private
data that it gets passed upon setup time and includes on callbacks.
|
|
|
|
| |
this was moved by accident when importing the code from openbsc.
|
|
|
|
|
| |
... and rather introduce a general osmo_talloc_replace_string() to
libosmocore.
|
| |
|
|
|