93 Commits

Author SHA1 Message Date
Bjorn Andersson
9dc7a88548 libqrtr: Zero-initialize sockaddr_qrtr
Valgrind complains that sockaddr_qrtr isn't properly initialized, even
though all fields are initialized. So explicitly clear the
sockaddr_qrtrs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
v1.0
2020-12-07 08:44:31 -08:00
Bjorn Andersson
983b223423 lookup: Add TFTP to known services list
Service 4096 is a QRTR based implementation of the TFTP RFCs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-11-16 10:38:14 -06:00
Loic Poulain
cb1a6476e6 qrtr-lookup: Add DPM service name
Data Port Mapper service is ID 47.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-11-06 22:09:30 -08:00
Adam Serbinski
47e48a8d93 Android: Disable "treat warnings as errors". 2020-09-28 10:21:36 -05:00
Adam Serbinski
33bf949e4f Clang: fix for arithmetic disallowed on void pointers 2020-09-28 10:21:21 -05:00
Alex Khouderchah
fef484babd libqrtr: Use size_t for offsets
Currently, offsetof produces an unsigned long, while qmi_elem_info's
offset member is a uint32_t. Since this is not the same type on all
platforms, this change uses a size_t for both. stddef.h is also
included for the standard offsetof definition, which also produces a
size_t.

This change also makes similar modifications to list.h.
2020-09-28 10:18:59 -05:00
Julien Massot
2ed52a30f6 qrtr-ns.service: do not install as executable
Fix
systemd[1]: Configuration file /lib/systemd/system/qrtr-ns.service is marked executable. Please remove executable permission bits. Proceeding anyway.
2020-09-28 10:17:11 -05:00
Bjorn Andersson
7bd5cf3024 ns: Go dormant when exsting name server is found
With the introduction of the in-kernel nameserver launching the user
space qrtr-ns will fail, but typically other services depends on its
presence. As such, go dormant instead of failing when noticed that the
name service is already present.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-01 18:05:04 -08:00
Amit Pundir
2afd6f87b3 ANDROID: Add Android.bp makefile
Add Android.bp makefile to build libqrtr.so, qrtr-ns,
qrtr-cfg and qrtr-lookup targets for AOSP.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-02-03 09:17:15 -08:00
Bjorn Andersson
cd6bedd5d0 qrtr-ns.service: Add systemd service
Add qrtr-ns.service template and install this into /lib/systemd/system
after modifying it according to $(DESTDIR) and $(prefix)

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-07-24 23:25:16 -07:00
Bjorn Andersson
111403fe72 map: Fix removal of entries from the table
Removing entries from an open addressed hash table creates holes in the
collision chains, preventing previous colliding entries to be found.  By
inserting tombstones, rather than clearing deleted entries makes it
possible to distinguish the end of a chain from a hole.

Reviewed-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-04-18 17:29:11 -07:00
Eric Caruso
c1bdfb37db logging: add min priority and other cleanup
The dprintf macro shadows a real libc symbol which is called
differently, so we should change it to something else (in this
case LOGD) and change it to use the libqrtr logging facilities.
This also means we should add a minimum priority to the logging
library so we don't log DEBUG-level messages by default.

Additionally there were some warn/warnx calls left over that
have been changed to PLOGW/LOGW respectively.
2018-12-10 16:03:04 -08:00
Eric Caruso
c9c4a3cdbd qrtr-lookup: print better information about DIAG service
The DIAG service has its own encoding for the instance number which
is unrelated to the version. This means that the information we
show to the user in the version and instance columns of the table is
parsed incorrectly and often useless. Instead, treat the instance
number as special if the service is a DIAG service and print out a
more meaningful interpretation.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-12-10 15:59:56 -08:00
Bjorn Andersson
a1694a1c93 libqrtr: Correct "instance" composition
The "instance" id of a service is a composition of the instance id and
the version. In some plaeces in the library I made this two half words
instead of the actually expected 8 bits version + 24 bit instance. Fix
this in the library.

This was not spotted previously because all prior work has dealt with
instance id 0, but with the QRTR support in Diag this is now an issue.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-03 22:01:48 -07:00
Ben Chan
f9b5b38b50 qmi: pass `const struct qrtr_packet' to qmi_decode_header()
Similar to qmi_decode_message(), qmi_decode_header() doesn't modify the
`struct qrtr_packet' argument. This patch makes qmi_decode_header() to
take a `const struct qrtr_packet' argument like qmi_decode_message()
does.

Contributed by Jacob Rutherford <jruthe@chromium.org>
2018-07-26 06:15:57 -07:00
Arun Kumar Neelakantam
4c4987ba7d libqrtr : Add support for signed one byte enum.
Add support to encode/decode one BYTE signed enum data type.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-16 09:03:29 -07:00
Ben Chan
eb666db04e qrtr-ns: initialize waiter_ticket struct in waiter_wait_timeout()
waiter_wait_timeout() doesn't initialize the 'callback' and 'updated'
fields of the waiter_ticket struct. The 'updated' field may contain some
garbage value, which is later read in waiter_ticket_check().

Signed-off-by: Ben Chan <benchan@chromium.org>
2018-07-05 06:58:25 -07:00
Ben Chan
0ba75091ab libqrtr: add extern "C" guard in libqrtr.h
This patch adds an extern "C" guard in libqrtr.h, so that it can be
included in both C and C++ projects.

Signed-off-by: Ben Chan <benchan@chromium.org>
2018-06-29 12:32:29 -07:00
Bjorn Andersson
a9c50b634f qrtr-lookup: Add description of service 52
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-25 16:36:04 -07:00
Ben Chan
4b7025a7c7 lookup: fix service name for service type 17
Service type 17 (0x11) is Specific Absorption Rate service, while
service type 25 (0x19) is Service Access Proxy service.
2018-06-22 10:54:20 -07:00
Eric Caruso
140a462c88 ns: add -s option for logging to syslog
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
de5ee77b00 logging: add use_syslog to qlog_setup
This causes qlog to log to syslog instead of logging to stderr.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
f64c25c8af Unify logging into one function
This prepares us to add log-to-syslog functionality by passing
all logging through one place.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-08 17:16:33 -07:00
Eric Caruso
516011d79f cfg, ns: factor out qrtr_set_address function
This function in qrtr-ns was largely copied from the main
function of qrtr-cfg. We should just factor it out so there is
one implementation instead.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-05-01 11:49:23 -07:00
Eric Caruso
3c60eb7e0e cfg, lookup, ns: avoid using __progname
The __progname symbol is a GNU extension and thus not portable,
but basename (from libgen.h) and argv[0] can be used portably
instead.

(qrtr-lookup already used argv[0] but did not apply basename, so
do that for consisntency.)

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
2018-05-01 11:41:34 -07:00