Age | Commit message (Collapse) | Author | Files | Lines |
|
If we fail to initialize the VTY, print an error mesage instead of
failing silently. For example:
"Cannot init VTY on 127.0.0.1 port 4247: Address already in use"
Change-Id: I24161f53fa621ae1c8b1916bd0c8055c494b531e
|
|
When reloading a script go through script_lua_close. Get the
primitive first. Then destruct the lua environment which will
lead to GC (e.g. cancellation of timers) and then delete the
primitive code.
Change-Id: I5bb4fa9e7c5010f3ad50b258dcb14956eea8822a
|
|
Make this symmetric and send the SMS through the primitive
interface. Construct and copy the sms into the prim, store
the SCA in the prim as well. In 04.11 we see we can store
2*10 digits in the destination address and a NUL.
Change-Id: I91d7537f4f6ce5ba00218c58f3456947ec7bc662
|
|
Change-Id: I0c08e071ffaac9b8e7c4af6a7be2bd8125145842
|
|
Nothing is actually being skipped in this function.
Change-Id: I9d5a33cf3a1dd7a75f9769d3c5ba85c59594b8f4
|
|
According to GSM 04.08, the System Information messages, such as
SI5, SI5ter, SI5bis and SI6 (described in sections 9.1.37-40),
have no the 'L2 Pseudo Length' (10.5.2.19) field, unlike others.
So, previously the ACCH SI messages were ignored due to an
implementation error - the gsm48_system_information_type_header
struct isn't applicable here, because it assumes the 'l2_plen'.
Since there is no (yet?) equivalent struct for the ACCH SI, this
change replaces the wrong struct by the 'gsm48_hdr', which
satisfies described requirements.
Moreover, this change cleans up some gsm48_rr_rx_sysinfo*
functions, getting rid of meaningless pionter shifting.
Change-Id: I9166996f146af7973bf02a8a1c965581dc58a4a5
|
|
In lua osmo.ms():name() will print the name/number of the MS. This
can be used by scripting code to use in events and then be analyzed.
Change-Id: I881d3e87daa19f4e6f4f5bd30fe95906129e60ef
|
|
Change parameters and check if the cb_ref is valid or not.
Change-Id: I74fbcd7e853e24b1225ecc4c19304134b8467c9b
|
|
We need continuation to avoid printing the logging category
again. E.g. when print(one, two, three) is called.
Change-Id: Id8491fa949768f170a8c74ab554cb1166afda1b7
|
|
Make the MS the script is associated with accessible to lua. Provide
access to IMSI and IMEI. The IMSI might not be available at the given
time and just return an empty string.
Example lua usage:
print(osmo.ms():imsi());
print(osmo.ms():imei());
print(osmo.ms():shutdown_state())
print(osmo.ms():started())
function ms_started_cb(started)
print("MS started", started)
end
function ms_shutdown_cb(old_state, new_state)
print("MS shutdown", old_state, "->", new_state)
end
function sms_cb(sms, cause, valid)
print("SMS data cb", sms, cause, valid)
for i, v in pairs(sms) do
print(i, v)
end
end
function mm_cb(new_state, new_substate, old_substate)
if new_state == 19 and new_substate == 1 then
osmo.ms():sms_send_simple("1234", "21321324", "fooooooo", 23)
end
end
local cbs = {
Started=ms_started_cb,
Shutdown=ms_shutdown_cb,
Sms=sms_cb,
Mm=mm_cb
}
timer = osmo.timeout(20, function()
print("Timeout occurred after 20s")
end)
osmo.ms():register(cbs)
# Can fail. Best to wait for state changes...
print(osmo.ms().start())
print(osmo.ms().stop(true))
Change-Id: Ia3ace33d6ba4e904b1ff8e271a02d67777334a58
|
|
Allow to callback into lua code after a user configured timeout. Make
it only work on seconds (truncate double to int).
Change-Id: I355d2f8d15aeaa13abb1c5e4a8e0c958e5faf7f3
|
|
Right now the script will be executed once it is loaded. Make sure
to write it into the config file last. Expose various log commands
for logging. Jump through some hoops and get the filename and line
number from lua.
Change-Id: I456f6b6b5e1a14ed6c8cb0dcc5140093d3c61ef6
|
|
Change-Id: Id2d266c48d30c06dfdc3b8c84d875038b43f2ad8
|
|
I will be adding a high-level async scripting interface to the
mobile application. The initial implementation will use Lua 5.3.
This version was released in January 2015 and is the latest version
at the time the commit was made. Lua as extension and extensible
language seems well suited for scripting.
The plan is to attach a script to a ms and be able to trigger high
level operations (send SMS, attach to network, detach).
Change-Id: Ic649e49a22c878585a6c20b5b80108909f2374eb
|
|
Notify once the mm state has been changed. Unfortunaley one state
transition can immediately trigger more transitions (recursively).
In the mid-term it might be best to force all primitives to be
async to avoid unpredictable behavior (e.g. make a shutdown while
being a recursion down?)
Change-Id: I8e9dcf7fd9116985aa060ba027ba74107a19223a
|
|
Inform the layer about new SMS and inform about the cause of
it. In both cases pass the SMS.
Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161
|
|
Forward started/shutdown changes to the primitive layer which will
turn them into indications. The other option might be to use the
signals but it seems primitives are a superset of the signals.
The notify will be done per MS and then the right primitive
instance will be searched and the indication be sent. The approach
will be applied to other systems as well.
The signal framework might be seen as
a subset of the primitives A signal mostly being a different form
of an indication.
Change-Id: I5df20a4ab79c06b515780675b6df2929aa976f0d
|
|
We want the script interface to interface through a primitive
interface. This will allow to move it to a different thread or
a process in the future. The script interface will just use the
primitives.
It is not clear how "sap" will be used here. I am keeping it
at 0 right now. The first primitive is starting a timer with a
request and then getting an indication as a response.
Change-Id: Id2456b7fae35546553c4805f12a40c0812d9255c
|
|
Move the check if within the mobile app there is no other active
MS using the same L1 socket. This way we can call this function
from the primitive code as well.
Change-Id: Ib4aa5ff212fa6bead8f620abaecc6a0b51a99fec
|
|
The "msg->tail - msg->l4h" subtract two unsigned char*
pointers and should result in a ptrdiff_t. Fix the
compiler warning by using "%ti" in the printf.
Fixes:
gsm411_sms.c: In function ‘gsm411_rx_rp_ud’:
gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
^
/home/ich/install/openbsc/include/osmocom/core/logging.h:93:54: note: in definition of macro ‘LOGPSRCC’
logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
^~~
/home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’
LOGPSRC(ss, level, NULL, 0, fmt, ## args)
^~~~~~~
gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’
LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
^~~~
gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
^
/home/ich/install/openbsc/include/osmocom/core/logging.h:95:53: note: in definition of macro ‘LOGPSRCC’
logp2(ss, level, __BASE_FILE__, __LINE__, cont, fmt, ##args); \
^~~
/home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’
LOGPSRC(ss, level, NULL, 0, fmt, ## args)
^~~~~~~
gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’
LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
Change-Id: Ia574fc7849bd00a94cf6651eb0d26fdc91ef1443
|
|
Change-Id: I8a1d975997e592344327e6b0783bd0c5d2534b02
|
|
In I4bac5f06921b5fd85a98d97770d42d4858ca1c42 I have removed the
msg_ref field. But in case we delete a transaction with a pending
SMS we need to get the msg_ref from somewhere. This is a partial
revert but for RX SMS it makes sure that msg_ref will be set (it
wasn't set before).
Change-Id: I9b0f90f875de5f072565878861d38b0bb3bfbded
|
|
ms->shutdown is ms->shutdown != 0 which should have been
converted to ms->shutdown != MS_SHUTDOWN_NONE. This is fixing
sending SMS.
This was introduced in Iee1140e4848923c7270495c381bf87b7e3fddee1.
Change-Id: Ia74374dd9c0dd0ba9cf5725d66f4d2f2a2cfe9ef
|
|
The SIs are kept per ARFCN and for the current cell the
cs->si alias will be assigned[1]. On mobile_exit all SIs
will be freed but the alias will not be set to NULL.
This is a speculative fix but it doesn't seem to make
things worse.
Related: OS#2690
[1] cs->si = cs->list[cs->arfci].sysinfo;
Change-Id: Icf20f9aa03dd26d4bee78772b7f3da034bb34b99
|
|
It seemed like msg_ref could go out of sync. In some places we are
using sms->msg_ref in other cases we pass it as parameter (e.g. when
sending the SMS) or we get it out of the gsm411_rp_hdr.
Instead of hardcoding 42 for all messages make it configurable and
pass the parameter from the caller.
Change-Id: I4bac5f06921b5fd85a98d97770d42d4858ca1c42
|
|
Instead of changing the field all over the place, do the state
change in a function. This will allow us to emit a notification
when things change. It is similar to the lchan_state.
Change-Id: I6a0591bb2785232681b23e41368323f16d3c960c
|
|
The enum was created to understand the different states during
the shutdown and find places where it is used. The normal
transitions are like.
Idle -> Imsi Detach -> L1 Reset -> Done
Idle -> L1 Reset -> Done
The shutdown can get stuck in case:
* Out of memory situation while handling IMSI detach (timeout)
* Never receiving l1 reset acknnowledgment.
The code could benefit from the move to osmo fsm to deal with
proper timeouts.
Change-Id: Iee1140e4848923c7270495c381bf87b7e3fddee1
|
|
The state handling is complicated and maybe it gets better by
moving started to bool and then the rest to an enum.
Change-Id: I6aef22e7bf954a8a4ecda980c2c558eb8c9180b7
|
|
Add a mobile application logging category and replace printf with
a LOGP. The code is sadly still using exit in the middle of handling.
Change-Id: I71e7f6e6375a485b45bad76ada2be17b0901577d
|
|
Change-Id: Ibbd1d080896b5cadc3d4281fe8f839a103a35088
|
|
"All" our VTY prompts have a space after the prompt.
Also do that for '(ms)', '(test-sim)' and '(support)' prompts.
Change
OsmocomBB(ms)#exit
to
OsmocomBB(ms)# exit
Change-Id: Id437279e0fa9845630a306958b404efa3b94b492
|
|
So far logging_vty_add_cmds wasn't called. The main.c might be
shared with other apps so place it into the routine that is
setting up the VTY.
Change-Id: I3db9cf288bce12f51e36caad44e9bc34094638f4
|
|
Change-Id: Ic12587a6c6456b8663e5357cf68a22c6d1927a07
|
|
This change prevents a possibility of calling memset()
with constant zero length parameter, and the corresponding
compiler warning.
Change-Id: I2d8d78474614939659a7f24d5007b1c890776b1a
|
|
I don't remember why we parse the categories like this. First if
the mobile doesn't use a subsystem there is no harm to have it
enabled, second the default levels can be adjusted for all apps
and third we have the VTY to reconfigure these logging targets.
Change-Id: Ia874b7ed127026b8395072a3bac2aed9944b1cce
|
|
vty_install_default() and install_default() will soon be deprecated.
Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I300a4b34a2031fd09d110ef18375d140a6dca7ba
|
|
As we use talloc, it's absurdly not to use the main feature of
the library - hierarchical memory management. This change sets
talloc context of all sub-allocated objects to related osmocom_ms
instance. So, as soon as osmocom_ms instance is destroyed, all
sub-allocated chunks are getting destroyed too.
Change-Id: I6e3467ff739f3e6dc8dd60cc6d1fcd3f8e490ce9
|
|
Change-Id: Id867ffed9b2b67025320d002e1e009e19c759a23
|
|
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' postfix in names, it's better to
use the updated functions.
Change-Id: I58150e9b74699e5f54b9a83416ad8efcb2eccd8e
|
|
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' postfix in names, it's better to
use the updated functions.
Change-Id: I4499b592a0dfea71462aed19fe641419d79b3cbd
|
|
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' suffix in names, it's better to
use the updated functions.
Change-Id: If8a1983592f5800e3981f29962eb333ac9473f40
|
|
According to the vty_app_info struct definition, the go_parent_cb()
should return an integer, but not enum. So, this change fixes the
following compiler warning:
> warning: initialization from incompatible pointer type
> .go_parent_cb = ms_vty_go_parent,
Change-Id: Ib55e43eaaebdd9fe0d74a030b1057ae82804a77e
|
|
The usage of msgb_set_talloc_ctx() was deprecated many days ago,
so it's time to use the proper replacement.
Change-Id: I56440d8e2152c4bb2e5ad677f88c61742d2ad9ca
|
|
This header contains declaration of the osmo_talloc_vty_add_cmds().
Change-Id: Icdafb22758897cfb67e249f37991f4af4213a5fa
|
|
This change registers the command, which is now implemented in
libosmocore since the 463deef8c209dd7eb023ac70bf41fa9893ad35ed
and allows to introspect mobile application's talloc context
directly from the VTY interface.
Change-Id: I979d64ae63d385f4fd082a4e3f981cbf5ab28338
|
|
It is better to have a shared example config files directory,
like other Osmocom projects do.
Change-Id: I903f31a8afc518ac258cdaeaf76430de07f7edea
|
|
Since we use indenting as means to implicitly exit child nodes,
no need to write 'exit' at the end of each child node.
Change-Id: I73b0f3926d766d21ca68c8e01b7fc70b2b4636c9
|
|
Since in recent version of libosmocore default commands (such as
'exit' and 'end') are being installed by default, no need to
install them twice. This will crash the program.
Change-Id: I82c8d04ccc7dc3f19589a79b859a2c993bd1d39c
|
|
The 903e2515 introduced the following problems:
- The home variable is allocated dynamically by talloc,
but not being freed. There is no need for dynamical
memory allocation, as the getenv() returns a pointer
to a value in the environment or NULL.
- In case of custom configuration file, a pointer to
a part of stack (not heap) is passed to talloc_free().
This may cause unexpected behaviour of segfault.
Let's fix both of them.
Change-Id: I79cc3b954c3018b7e780f6351c3030c3062470b5
|
|
All other Osmocom projects use '-c' command line option to specify the
location of config file. Let's do the same with fallback to existing
implicit config file name logic.
Also print config file path and vty host on startup.
Change-Id: Idaac3ff8d1f8541e00c45290db948a67bb899311
|