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

4519 commits

Author SHA1 Message Date
Andy Green
3549a94ce6 roles: compress role ops structs
role ops are usually only sparsely filled, there are currently 20
function pointers but several roles only fill in two.  No single
role has more than 14 of the ops.  On a 32/64 bit build this part
of the ops struct takes a fixed 80 / 160 bytes then.

First reduce the type of the callback reason part from uint16_t to
uint8_t, this saves 12 bytes unconditionally.

Change to a separate function pointer array with a nybble index
array, it costs 10 bytes for the index and a pointer to the
separate array, for 32-bit the cost is

2 + (4 x ops_used)

and for 64-bit

6 + (8 x ops_used)

for 2 x ops_used it means 32-bit: 10 vs 80 / 64-bit: 22 vs 160

For a typical system with h1 (9), h2 (14), listen (2), netlink (2),
pipe (1), raw_skt (3), ws (12), == 43 ops_used out of 140, it means
the .rodata for this reduced from 32-bit: 560 -> 174 (386 byte
saving) and 64-bit: 1120 -> 350 (770 byte saving)

This doesn't account for the changed function ops calling code, two
ways were tried, a preprocessor macro and explicit functions

For an x86_64 gcc 10 build with most options, release mode,
.text + .rodata

before patch:          553282
accessor macro:        552714 (568 byte saving)
accessor functions:    553674 (392 bytes worse than without patch)

therefore we went with the macros
2020-11-28 10:58:38 +00:00
Andy Green
9eb4c4fac2 client: rfc6724 dns results sorting
RFC6724 defines an ipv6-centric DNS result sorting algorithm, that
takes route and source address route information for the results
given by the DNS resolution, and sorts them in order of preferability,
which defines the order they should be tried in.

If LWS_WITH_NETLINK, then lws takes care about collecting and monitoring
the interface, route and source address information, and uses it to
perform the RFC6724 sorting to re-sort the DNS before trying to make
the connections.
2020-11-28 10:58:07 +00:00
Andy Green
d38d1176ca clean: client connect 2020-11-26 09:23:30 +00:00
Andy Green
1b7c0a08fc udp: convert to sa46
Let's stop using sockaddr and migrate to lws_sockaddr46 so the udp path
works more the same as the tcp / uds client connect path.
2020-11-26 09:23:30 +00:00
Andy Green
495a966302 mqtt: lws_system blobs for password username 2020-11-26 09:23:30 +00:00
Jed Lu
0f98972ab5 ss: skip null metadata 2020-11-26 09:23:30 +00:00
Andy Green
cab63090e6 osx: work around some big sur machines getting MAX_LONG ulimit -n 2020-11-26 09:23:30 +00:00
Michael Johanssen
bd45526af3 cmake: windows: update FindOpenSSLbins.cmake 2020-11-26 09:23:24 +00:00
Yichen Gu
544b668605 sspc: lws_sspc_handle_t pointer in wsi used after free 2020-11-12 19:54:27 +00:00
Andy Green
3216d4d087 ss: server: add foreach client cb api
Server SS maintains a list of accepted client ss, add an api allowing
iterating through the clients via a user callback.
2020-11-11 06:58:20 +00:00
Andy Green
0d31b7a154 buflist: additional helpers 2020-11-09 07:40:40 +00:00
gaoshan
4189d80e95 cmake: support iOS armv7 build 2020-11-09 07:40:40 +00:00
Andy Green
1476e60e75 ss: server: support unix sockets 2020-11-09 07:40:40 +00:00
Andy Green
6bc5c0ffac reduce debug logging 2020-11-09 07:40:35 +00:00
Yichen Gu
3bfa00de19 ss: h2: ACK/NACK missing in H2 state flow 2020-11-02 12:03:16 +00:00
Pino Toscano
c623ebfe87 context: properly check for sys/resource.h
Instead of hardcoding where sys/resource.h is available, check for it
using cmake.
2020-11-01 12:14:19 +00:00
Andy Green
b4e3bc381c sai: win10 no pthreads and debian buster 32-bit 2020-10-29 19:48:34 +00:00
Andy Green
de2fa67478 ss: policy: cast uint32 lwsl_err arg to unsigned int
Some toolchains typedef uint32_t to unsigned long
2020-10-29 19:46:00 +00:00
Andy Green
c674181136 ss: fix without server 2020-10-29 19:41:08 +00:00
Andy Green
5c988d7714 plugins: more explicit header inclusion
32-bit Debian doesn't have these included by other includes
already and needs them explicitly.
2020-10-26 11:24:21 +00:00
Andy Green
664992aea5 sai: plugins 2020-10-26 11:16:56 +00:00
Andy Green
0ba400ce81 sai: debian 2020-10-26 09:05:46 +00:00
Andy Green
942f46b7d4 lwsws: add -n to allow skipping lws plugins dir 2020-10-20 11:06:12 +01:00
Andy Green
c2271b4ec6 sai: tls: test openssl 3 without gencrypto
Gencrypto needs work to adapt against deprecated openssl 3 apis (about
100 apis).  But we can still test it without gencrypto, for use with
socket connections generally, where it is working.
2020-10-19 16:35:03 +01:00
bbqz007
b168fa4157 libevent: fix typo in signal handler
https://github.com/warmcat/libwebsockets/issues/2095
2020-10-19 16:35:03 +01:00
Andy Green
22e6d5212b spawn: in discrete env setting case do it readonly
OSX changed to blow a segfault on write to .rodata, exposing that
we're dropping a NUL in what can be .rodata to set the environment
manually.  We don't do this on Linux typically because we take the
code path where execvpe() is available to do the env for us.

Adapt the code to treat it as const, and underscore it by changing
its type to be const char ** in the info struct.
2020-10-19 16:35:03 +01:00
Andy Green
8eef15f3aa docs: ss: update client state lifecycle with destroy api note 2020-10-19 16:35:03 +01:00
krismattheus
b011a915ed cmake: add windows version resources to library
Signed-off-by: krismattheus <kris.mattheus@visionbms.com>
2020-10-19 16:35:03 +01:00
owent
dddc68ec2d netlink: check for RTA_PREF before use
Old kernels like v3.10 don't have it

 [#2079](https://github.com/warmcat/libwebsockets/issues/2079)
2020-10-19 16:35:03 +01:00
Andy Green
643a001ed8 roles: netlink
This creates a role for RFC3549 Netlink monitoring.

If the OS supports it (currently, linux) then each pt creates a wsi
with the netlink role and dumps the current routing table at pt init.
It then maintains a cache of the routing table in each pt.

Upon routing table changes an SMD message is issued as an event, and
Captive Portal Detection is triggered.

All of the pt's current connections are reassessed for routability under
the changed routing table, those that no longer have a valid route or
gateway are closed.
2020-10-19 16:35:03 +01:00
Andy Green
915f888f3e sa46: network check
This adds a helper to test if an sa46 is on an sa46-based subnet.

The compare helper is adapted to say that non INET/INET6 addresses with
the same AF match.
2020-10-19 16:35:03 +01:00
Andy Green
21719898e8 wsi: store peer lws_sockaddr46
If we connect out to an IP address, or we adopt a connected socket,
from now on we want to hold the peer sockaddr in the wsi.

Adapt ACCESS_LOG to use this new copy rather than keep the
stringified version.
2020-10-19 16:35:03 +01:00
Andy Green
67d24d7c00 cleaning 2020-10-19 16:35:03 +01:00
Andy Green
44e860642b docs: switch to use main 2020-10-19 16:35:03 +01:00
Andy Green
1ee190304e README.md: master to main transition 2020-10-19 16:35:02 +01:00
Andy Green
4e973c3cc5 ss: metadata: rename value to add reminder about heap 2020-10-19 16:34:54 +01:00
Andy Green
657cadf7c6 http: bind PUT and friends to mounts 2020-10-10 06:52:42 +01:00
casey
eddecea3c8 fix zombie sul detection
The cmake define isn't exported, and msvc objects to void * comparision to
non void *.

Also dump the callback pointer with any errors, since after looking it up
in your mapfile this is usually enough to understand which sul and when it
was set.
2020-10-10 06:43:32 +01:00
Andy Green
db5b2c1403 close: ensure any pending sul_connect_timeout cancelled 2020-10-09 21:30:49 +01:00
Andy Green
8d88d2f4f1 plugins: use new export symbol convention 2020-10-09 21:30:49 +01:00
Andy Green
170a5db028 cgi: support evlib_wsi in stdwsi 2020-10-09 21:30:45 +01:00
Andy Green
27964ddaf2 ws: reporting PONG with pmd enabled
Add a return code NOTHING_WE_SHOULD_DO indicating that the
extension determined by ext-specific means its operation was
disabled on this frame.

https://github.com/warmcat/libwebsockets/issues/2076
2020-10-09 08:00:44 +01:00
casey
e44c8698ca windows: null check wsi before udp check 2020-10-09 06:55:02 +01:00
casey
5d025839c6 windows: fix WSA event destruction
pt->events became an array
2020-10-09 06:53:44 +01:00
Andy Green
04d947b6f7 windows: WSA loop fixes 2020-10-08 14:52:54 +01:00
Andy Green
2ad378095d freertos: have lwip choose the cancel pipe port
Rather than a magic port, let's have lwip pick the port for
the UDP cancel "pipe", so no chance of conflict.
2020-10-08 11:21:45 +01:00
Jed Lu
ee78b90c8c ss: take care to free any metadata heap values before overwrite
Break out the core ss_set_metadata action into a subfunction that
takes the lws_ss_metadata_t, and is fixed to retire heap-based
values before they go out of scope, and adapt the exported version
to call through to that.

Simplify extract_metadata() to reuse the subfunction as well, in
both well-known and custom header cases.
2020-10-07 19:20:12 +01:00
Andy Green
5f7da4a530 struct_json: adapt api test for 32-bit int on windows 2020-10-06 21:21:19 +01:00
Sylvain Rochet
309b08d830 contrib: cross-atmel: build-out FILE_OPS
Fix build failure against Atmel ASF3 SDK that does not provide a file
API conforming to POSIX.

libwebsockets/lib/core/libwebsockets.c: In function 'lws_open':
libwebsockets/lib/core/libwebsockets.c:187:18: error: 'O_CREAT' undeclared (first use in this function)
  if (((__oflag & O_CREAT) == O_CREAT)
                  ^~~~~~~
2020-10-06 20:30:29 +01:00
Andy Green
8c88b857a9 h1: explicitly close when post txn completes
https://github.com/warmcat/libwebsockets/issues/2072
2020-10-06 13:56:45 +01:00