1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

93 commits

Author SHA1 Message Date
Andy Green
4a23c07bf4 async dns: allow up to 8 x 128-char CNAMEs from 4
https://github.com/warmcat/libwebsockets/issues/3329

Extra ~600 bytes stack needed might be a struggle for RTOS, trimmed from 10
recommended in issue.
2025-02-27 07:41:00 +00:00
Andy Green
837db622eb clean: avoid maybe-uninitialized
https://github.com/warmcat/libwebsockets/issues/3049
2024-01-16 07:15:30 +00:00
Andy Green
247cf01935 coverity: reorder NULL check 2022-05-04 08:42:32 +01:00
Andy Green
198a85b53c async dns: handle late udp creation
We may have to retry the UDP socket creation to the DNS servers until
network is up.
2022-04-24 06:48:50 +01:00
Andy Green
b43866ffeb asyncdns: also consult system hosts file
We should also consult any system hosts file if available as part of the
async dns prep, same as we check for numeric IPs.
2022-04-10 06:56:12 +01:00
Andy Green
fcbc0dafa4 lws_ota 2022-03-25 08:18:30 +00:00
Andy Green
1b70ae9296 adns: bump DNS_MAX to 128 2022-03-15 10:28:09 +00:00
Andy Green
3feddc06a4 examples: lgtm fixes now on by default 2021-11-29 15:18:15 +00:00
Andy Green
ba89af373b async dns: allow multiple servers and public add remove apis 2021-11-17 14:50:08 +00:00
Andy Green
a3592cbe4f adns: api-test: add synthetic result parsing
Add some exports so the api test can inject results into the parser for
live queries, suppressing asking the server but otherwise following the
flow.

Provide two new suspect responses for injection and parsing in ctest.

Add a --cos option to minimal-http-client to force a close after the
connection has started the async dns.
2021-10-18 09:58:16 +01:00
Andy Green
a51def06a1 coverity: adns: check length against 1500 2021-10-17 12:03:07 +01:00
Andy Green
d730351fa3 adns: fix label limit check 2021-10-17 12:02:26 +01:00
Felipe Gasper
9c718e47e2 logs: log context: async_dns
Of note: A single use of lwsl_debug() remains because the function in
question is documented as a public API, but the passed-in parameter
doesn’t offer a path to a logging context.
2021-10-16 08:23:09 +01:00
Andy Green
028deaeaa5 smd: take message lock earlier 2021-10-12 09:14:47 +01:00
Andy Green
2cfa260e62 sspc: refactor to allow different transports
This is a NOP for existing usecases.

At the moment the only implemented transport for serialized SS is wsi, it's
typically used with Unix Domain Sockets, but it also works over tcp the
same.

It generalizes the interface between serialized chunks and the
transport, separately for client and proxy.  The wsi transport is migrated
to use the new transport ops structs.

It will then be possible to "bring your own transport", so long as it is
reliable, and in-order, both for proxy and client / sspc.

We also adapt minimal-secure-streams-binance to build the -client variant
via SS proxy as well.

LWS_ONLY_SSPC is added so libwebsockets can be produced with just sspc
client support even for tiny targets.

A new embedded minimal example for rpi pico is also provided that
demonstrates using Serialized SS over a UART to an SS proxy, to implement
the SS Binance example on the pico, even though it has no networking itself.
2021-10-08 09:48:41 +01:00
Andy Green
1dbf1d8148 freertos: suppress return check on xSemaphoreTake
With the timeout set to portMAX_DELAY, there is no timeout and so no way
for the api to return failure.

https://www.freertos.org/a00122.html

However Coverity doesn't understand this, and futher, Coverity usually
ignores (void) result casts.  So add needless checks and the corresponding
needless unwinding to the 10 uses of lws_mutex_lock() in smd.c.

Invert the return value to align it with pthreads mutex lock return
semantics.
2021-10-08 09:48:29 +01:00
Andy Green
d069098683 conmon: async-dns: off-by-one 2021-10-05 07:09:55 +01:00
Andy Green
06e881aad6 esp32c3
Add
2021-08-31 05:45:40 +01:00
Andy Green
2b75c6fb89 smd: avoid recursive lock when unregistering during delivery 2021-08-16 08:07:35 +01:00
Andy Green
36e7e8af78 fault injection: pseudorandom 64-bit range support
This adds an api allowing fault injection path implementations to get hold
of pseudo-random numbers between an externally-provided range.

You can set it using, eg, --fault-injection "f1(10%),f1_delay(123..456)"
while f1 shows how to decide whether to inject the fault and f1_delay
provides a pseudo-random number between the two values for the fault
implementation code to use.
2021-07-04 10:29:54 +01:00
Andy Green
fabe78d222 Wextra
Add -Wextra (with -Wno-unused-parameter) to unix builds in addition to
-Wall -Werror.

This can successfully build everything in Sai without warnings / errors.
2021-07-04 10:29:54 +01:00
Andy Green
5d8cf03221 logs: log contexts 2021-07-01 05:20:53 +01:00
Andy Green
8e76634ed3 logs: introduce log_cx 2021-07-01 05:20:53 +01:00
Andy Green
9fe4b37650 wilcard: change api to use length for check
The wilcard part was always length driven... but the check part relied on
being NUL terminated.  Change that to also use a length specifier and not
need any NUL.

To migrate old uses, just add a fourth param as strlen(check).
2021-06-07 14:57:57 +01:00
Andy Green
891f28b43e ss: proxy: fix conn deref on onward
Trying to use the opaque pointer in the handle to point to the conn isn't
going to work when we need it to point to the ss handle.

Move it to have its on place in the handle.
2021-04-21 10:02:00 +01:00
Andy Green
402e97a679 ss: metrics: http: just report at wsi close
Defer recording the ss metrics histogram until wsi close, so it has a
chance to collect all the tags that apply.

Defer dumping metrics until the FINALIZE phase of context destroy, so we
had a chance to get any metrics recorded.
2021-04-08 06:47:54 +01:00
Andy Green
51490ae6e6 Fault injection
add lws_xos: xoshiro256 PRNG
2021-04-05 10:55:04 +01:00
Andy Green
e4d381eadd metrics: increase type of us_schedule to uint64_t 2021-04-02 16:50:49 +01:00
Andy Green
9d13b97e37 client: DNS failure should retry while waiting for connect timeout
If the DNS lookup fails, we just sit out the remaining connect time.

The adapts it to reuse the wsi->sul_connect_timeout to schedule DNS lookup
retries until we're out of time.

Eventually we want to try other things as well, this is aligned with that.

Found with fault injection.
2021-03-11 06:58:59 +00:00
Andy Green
3f4623bb36 lws_metrics
There are a few build options that are trying to keep and report
various statistics

 - DETAILED_LATENCY
 - SERVER_STATUS
 - WITH_STATS

remove all those and establish a generic rplacement, lws_metrics.

lws_metrics makes its stats available via an lws_system ops function
pointer that the user code can set.

Openmetrics export is supported, for, eg, prometheus scraping.
2021-03-08 21:47:28 +00:00
Andy Green
9af105ebf8 sai: xenial 2021-02-28 19:05:25 +00:00
Andy Green
b47511352e async-dns: 2021-02-20 13:54:38 +00:00
Andy Green
3fe08ce5d8 fault injection 2021-02-20 13:54:35 +00:00
Andy Green
8a087043c6 smd: account for new interested peers joining while queue exists 2021-02-20 13:54:35 +00:00
Andy Green
599691d233 dhcp: clean 2021-02-17 11:39:15 +00:00
Andy Green
f42c97baa9 route: on change also check source address still extant 2021-02-17 11:39:12 +00:00
Andy Green
8a6df77dce adns: keep last 3 tids for slow responses 2021-02-09 17:11:25 +00:00
Andy Green
24c0814fd3 async dns: correctly deal with cb killing wsi 2021-02-09 16:56:09 +00:00
Andy Green
a6d81e3fcc async dns: add dump helper when _DEBUG 2021-02-03 08:49:54 +00:00
Andy Green
79c02baa9e async dns: add write confirm sul
If no routeable gateway, we can be unable to get WRITEABLE.  Add
a sul in the query to limit that situation to 3s before failing
the query.
2021-02-03 07:21:45 +00:00
Andy Green
3192b3cab9 adns-api-test-l
Add -l option on lws-api-test-async-dns that makes it sit there trying to
lookup warmcat.com every 5s until ^C.  This is useful to test behaviour
over loss of connectivity and regaining it.
2021-02-03 07:21:45 +00:00
Andy Green
d5618f6059 Wconversion: workarounds for CentOS7 2021-01-22 12:25:03 +00:00
Andy Green
8ff35b819a smd-add-ss-rx-forwarder-helper
Add a helper to simplify passing smd ss rx traffic into the local
smd participants, excluding the rx that received it externally to
avoid looping.

Make the smd readme clearer with three diagrams and more explanation
of how the ss proxying works.
2021-01-05 10:56:38 +00:00
Andy Green
962993fd24 smd: add ss tx helper 2021-01-05 10:56:38 +00:00
Andy Green
619ef5eb17 smd: add use class base index
In addition to the well-known classes, add a user class base bit offset
so distributed user applications can cleanly send messages using SMD
2021-01-05 10:56:38 +00:00
Andy Green
4b2c0fdc1d smd: lock when removing messages 2021-01-05 10:56:38 +00:00
Andy Green
c9731c5f17 type comparisons: fixes
This is a huge patch that should be a global NOP.

For unix type platforms it enables -Wconversion to issue warnings (-> error)
for all automatic casts that seem less than ideal but are normally concealed
by the toolchain.

This is things like passing an int to a size_t argument.  Once enabled, I
went through all args on my default build (which build most things) and
tried to make the removed default cast explicit.

With that approach it neither change nor bloat the code, since it compiles
to whatever it was doing before, just with the casts made explicit... in a
few cases I changed some length args from int to size_t but largely left
the causes alone.

From now on, new code that is relying on less than ideal casting
will complain and nudge me to improve it by warnings.
2021-01-05 10:56:38 +00:00
Andy Green
3ced2a4f90 sys: blob: appended bugflist blob offset by LWS_PRE 2021-01-04 05:40:12 +00:00
Andy Green
a13b34db1c smd: add warning for queue depth 2021-01-04 05:40:12 +00:00
Andy Green
0ceba15d9c lws_lifecycle
This adds some new objects and helpers for keeping and logging
info on grouped allocations, a group is, eg, SS handles or client
wsis.

Allocated objects get a context-unique "tag" string intended to replace
%p / wsi pointers etc.  Pointers quickly become confusing when
allocations are freed and reused, the tag string won't repeat
until you produce 2^64 objects in a context.

In addition the tag string documents the object group, with prefixes
like "wsi-" or "vh-" and contain object-specific additional
information like the vhost name, address / port  or the role of the wsi.
At creation time the lws code can use a format string and args
to add whatever group-specific info makes sense, eg, a wsi bound
to a secure stream can also append the guid of the secure stream,
it's copied into the new object tag and so is still available
cleanly after the stream is destroyed if the wsi outlives it.
2021-01-04 05:26:50 +00:00