aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix
Commit message (Collapse)AuthorAge
* remaps EAI_AGAIN to NNG_EADDRINVAL (#2169)Jon Gjengset2025-10-04
| | | | | | | | | | | | | | | | | | | | | | | | When running nng tests in CI under nix on Linux, I would see `nng_dialer_start` fail with `NNG_EAGAIN` when invoked with `flags = 0` and a URL of `tcp://999.888.777.666:8080` (this is in a test that is supposed to check that dialing that gives you `NNG_EINVAL` or `NNG_EADDRINVAL`). This can happen if `nni_resolv_ip` in `posix_resolv_gai.c` gets `EAI_AGAIN` from `getaddrinfo`, which the man pages suggest _can_ happen due to "a temporary failure in name resolution". In the nix case, this is due to the nix build sandbox, but it can also arise simply due to DNS overload or misconfiguration. In either case, nng should not bubble up `EAI_AGAIN` `as `NNG_EAGAIN` from `nng_dialer_start`, as `NNG_EAGAIN` has a different semantic meaning. `NNG_EAGAIN` is more equivalent to "would block", and should only be generated through calls with the `NONBLOCK` flag. We don't have a perfect mapping for `EAI_AGAIN`, but the closest is probably `NNG_ADDRINVAL` to indicate that we failed to resolve the given address (even if it's temporary). Another option would be to introduce another error variant like `NNG_ENAMELOOKUP`, but that felt excessive to cover this case.
* Disable illumos event ports until we can debug them.Garrett D'Amore2025-08-24
|
* Improve tests for SUNOS socketpair.Garrett D'Amore2025-08-24
|
* OmniOS fixes.Garrett D'Amore2025-08-24
| | | | | It is a bit of a mystery how we were passing CI/CD with all these problems. Probably we were falling back to select/poll instead of using ports.
* Fix build error on omnios.Garrett D'Amore2025-08-24
|
* Fix omnios clang-19 not foundGarrett D'Amore2025-08-24
|
* posix tcp: use after free in listener (need to stop before free)Garrett D'Amore2025-06-22
|
* Introduce DTLS transport for NNG.Garrett D'Amore2025-06-01
| | | | | | | | | | | | | This introduces a new experimental transport for DTLS, that provides encryption over UDP. It has a simpler protocol than the current UDP SP protocol (but we intend to fix that by making the UDP transport simpler in a follow up!) There are a few other fixes in the TLS layer itself, and in the build, that were needed to accomplish this work. Also there was an endianness bug in the UDP protocol handling, which is fixed here.
* Converted property functions to use nng_err.Garrett D'Amore2025-04-27
|
* Transport listen: use nng_errGarrett D'Amore2025-04-27
|
* More nng_err -- this time for dialer and listener allocations.Garrett D'Amore2025-04-27
|
* AIO: Use nng_err for cancellation callback instead of int.Garrett D'Amore2025-04-27
| | | | | | This is part of our work to improve type safety/awareness, and also improve debugger support, for NNG error codes. There are still quite a few more but this should help.
* TLS: break up the TLS layer a bit to refactor for DTLS.Garrett D'Amore2025-04-27
| | | | | | | | | | | This allows us to break the assumption that the bottom half is TCP, or even an nng_stream, since the DTLS layer will use a totally different layer. Only nng_stream neeeds to support dial and listen. Also: UDP: Make the sockaddr arguments to open const. Also: Align the IPv6 address in the sockaddr (this allows for efficient 64-bit or even 128-bit operations on these values.)
* posix_pollq_epoll.c:add EPOLLHUP flag to aovid code error continues ↵wangchen2025-03-15
| | | | | | | | executing in tcp_cb the reason of the modification refers to https://github.com/nanomsg/nng/issues/2100 Signed-off-by: wangchen <wangchen41@xiaomi.com>
* socketpair: use nng_errGarrett D'Amore2025-01-14
|
* posix: move tcpdialer definition out of shared headerGarrett D'Amore2025-01-05
|
* platform: remove reader/writer locksGarrett D'Amore2025-01-05
| | | | | | The only thing using this was the transport lookups, but as those transports are now fully initialized in nng_init, we no longer need to lock that at all.
* platform: eliminate NNI_CV_INITIALIZER altogetherGarrett D'Amore2025-01-05
|
* pthreads: avoid double indirection for cv mutexGarrett D'Amore2025-01-05
|
* Liberally apply some UWYI (use what you include) to header filesGarrett D'Amore2025-01-05
|
* fixes #2061 Move IPC parameters from uint64 to intGarrett D'Amore2025-01-03
|
* poll poller: support concurrency for pollers using poll()Garrett D'Amore2024-12-30
|
* poller: port events scalability (illumos/Solaris)Garrett D'Amore2024-12-30
|
* fixes #530 POSIX pollqs should scale horizontally (epoll)Garrett D'Amore2024-12-30
| | | | | | | | This should help Linux platforms scale even further with NNG. Port events and *maybe* poll are the last to do. Probably select will remain left in the cold, because honestly select based systems are already performance constrained.
* kqueue: support concurrent pollersGarrett D'Amore2024-12-30
| | | | | | | | | | | | | This allows greatly increased scalability for kqueue based systems with lots of cores (more likely FreeBSD than Darwin, as most macs only have a smattering of cores), but even for macs we can engage a few cores for system calls giving improvements. The implementation here is pretty simple -- each file descriptor gets assigned to its own kqueue by taking the numeric value of the file descriptor modulo the number of kqueues we have opened. The same approach will be adopted for epoll and Solaris/illumos port events.
* ipc test: add a case for IPC that never connectsGarrett D'Amore2024-12-30
| | | | | | | This involved test-specific hacks, since connect() for UNIX domain sockets always completes synchronously one way or the other, even though it is documented that it might not. This found a bug, with an uninitialized poll FD as well!
* fixes #863 socket activation: for TCP and IPC (POSIX only)Garrett D'Amore2024-12-30
| | | | | | | | | This introduces a new option "NNG_OPT_LISTEN_FD", understood by TCP, TLS, and (on POSIX systems) IPC. This option is used to pass a file descriptor or handle (Windows) that is already listening (ready for ACCEPT to be called). For TCP and TLS, the socket must be of type AF_INET or AF_INET6, and for IPC it must be of type AF_UNIX.
* posix: fall back to send if sendmsg is unavailable for ipc and tcpGarrett D'Amore2024-12-29
| | | | | This will be slower, as each vector element has to be sent in a single system call, but for platforms that lack sendmsg it will at least work.
* udp: use a bounce buffer if we lack sendmsg or recvmsgGarrett D'Amore2024-12-29
| | | | | This includes checks to determine if those functions are present, and a test case to verify that scatter gather with UDP works.
* resolver: add some additional test coverageGarrett D'Amore2024-12-29
| | | | | | While here, remove some code paths that do not occur by definition. (For example, if the resolver succeeds, we will definitely have a valid set of addresses, but if it fails, we will definitely not.)
* resolver: use explicit resolver item provided by callerGarrett D'Amore2024-12-28
| | | | | | This avoids the need to perform multiple allocations for dialing, eliminating additional potential failures. Cancellation is also made simpler and more perfectly robust.
* tcp stream: add test for ESTATE getting port on unbound listenerGarrett D'Amore2024-12-28
|
* tcp: flatten the listener implementationGarrett D'Amore2024-12-28
| | | | | | | | | | The endpoints both use a nesting level for some common code and some platform dependent code. But the common code isn't that much and we have similar patterns for e.g. IPC. This avoids a layer of indirection in the structs, and extra allocations. The payoff will be even larger for the dialers, but that is next. (Dialers are more complicated because of DNS.)
* udp: use nni_aio_startGarrett D'Amore2024-12-26
| | | | | | This also moves the close of the UDP socket later, to avoid a potential use after free while the aio's are still in-flight. Unfortunately we cannot unbind cleanly without a hard close.
* ipc: use nni_aio_startGarrett D'Amore2024-12-26
|
* resolver: use nni_aio_startGarrett D'Amore2024-12-26
|
* tcp: use nni_aio_startGarrett D'Amore2024-12-26
|
* sockfd: convert to use nni_aio_startGarrett D'Amore2024-12-26
|
* posix resolver: use nni_aio_deferGarrett D'Amore2024-12-24
|
* aio: introduce nni_aio_deferGarrett D'Amore2024-12-22
| | | | | | | | This will replace nni_aio_schedule, and it includes finishing the task if needed. It does so without dropping the lock and so is more efficient and race free. This includes some conversion of some subsystems to it.
* posix tcp: use common refcnt implementationGarrett D'Amore2024-12-22
|
* port events poller (illumos/Solaris): use atomic events maskGarrett D'Amore2024-12-22
|
* epoll: use atomic event maskGarrett D'Amore2024-12-22
|
* pollers: use atomic bit masking operations to eliminate lockssGarrett D'Amore2024-12-22
| | | | This is done for kqueue and poll. Others coming soon.
* ipc dialer: use common refcnt logicGarrett D'Amore2024-12-22
|
* poll: sign extension bug + incorrect use leads to tiny max files on macOSGarrett D'Amore2024-12-22
|
* posix IPv6: BSD platforms us netinet6/in6.hGarrett D'Amore2024-12-21
|
* posix udp: AF_INET6 fixupGarrett D'Amore2024-12-21
|
* posix udp: More explicit checks for bogus address familyGarrett D'Amore2024-12-21
| | | | | This triggered an error on FreeBSD because apparently FreeBSD will return a different value when seeing an AF_UNIX socket with UDP.
* posix udp: stop the PFD explicitly before finalizingGarrett D'Amore2024-12-21
|