Commit Graph

150 Commits

Author SHA1 Message Date
Boris Pek ef83b31cec Fix spelling errors 2019-02-25 19:46:24 +01:00
Jan Vidar Krey f0e9b2ffd9 Add support for OpenSSL 1.1 2018-02-26 10:58:41 +00:00
Jan Vidar Krey 11538d6909 Mute debug log messages for net_send() that were incorrectly classified as error messages. 2018-01-15 17:00:56 +00:00
Jan Vidar Krey 204544298b Cleanup debug logging. 2014-10-16 23:14:12 +02:00
Jan Vidar Krey 418db22931 Merge branch 'master' of github.com:janvidar/uhub 2014-10-16 23:10:28 +02:00
Jan Vidar Krey 037ceff0a5 Disable SSLv3 explicitly also. 2014-10-16 23:09:50 +02:00
Jan Vidar Krey 44708e8433 Move some network, timer code. 2014-10-16 23:09:12 +02:00
Jan Vidar Krey 76ff2a1a13 Fix TLS protocol mismatch assert causing the hub to shutdown. 2014-10-16 23:08:17 +02:00
Tillmann Karras 3d0b652ec9 Remove some unused variables 2014-10-06 21:02:08 +02:00
Jan Vidar Krey d7c8c9426d Fix memory leak by creating the SSL context once for ADC client.
This is done using reference counted global memory.
2014-08-06 17:37:06 +02:00
Jan Vidar Krey 95de69efeb Added functionality to fetch the TLS version and cipher info for a connection. 2014-08-05 17:43:24 +02:00
Jan Vidar Krey b3b4876c08 Use TLS 1.2 when connecting to a hub when using TLS. 2014-08-05 17:42:18 +02:00
Jan Vidar Krey ac543e3df4 Clear connection timeout timer when successfully connecting. 2014-08-05 17:40:55 +02:00
Jan Vidar Krey 46bdc77066 Added a notification mechanism for sending messages from
another thread to the mainthread in a safe manner.

This is used for the DNS lookup code, and can also
be used by the signal handler to safely report actions back
to the application mainloop without using global variables.
2014-08-05 16:21:56 +02:00
Jan Vidar Krey 1526d63403 Simplify list_clear(), allow NULL as free() function pointer.
This makes it redundant to create a null_free() or dummy_free() function
that does nothing.
2014-08-05 13:08:46 +02:00
Jan Vidar Krey cbe0b4e108 Potential crash fix for tools. 2014-07-29 17:35:14 +02:00
Jan Vidar Krey b85381c0f5 Added configuration options for TLS cipher suites and TLS versions. 2014-07-29 13:31:42 +02:00
Hector Martin 0426cb523a Fix: Rework SSL poll event handling to avoid infinite loops
The downstream connection callback must only be invoked when the event
that SSL requests for the connection to make progress has actually
occured. Otherwise, the downstream callback might do nothing but
re-queue an unrelated event (e.g. in user_net_io_want_write), and the
event loop comes around instantly while making no progress. Track the
SSL-requested events separately and deliver the required downstream
event when they fire.

Sample strace:

epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: User writes data, OpenSSL tries to write data
write(96, <snip>..., 170) = -1 EAGAIN (Resource temporarily unavailable)
: handle_openssl_error requests NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLOUT, {u32=96, u64=96}}) = 0
: User callback then requests NET_EVENT_READ|NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLIN|EPOLLOUT, {u32=96, u64=96}}) =
: Data available for *reading*
epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: again...
2014-07-29 12:09:07 +02:00
Jan Vidar Krey 9f78a2e85f Merge branch 'master' of github.com:janvidar/uhub 2014-05-30 15:06:23 +02:00
Jan Vidar Krey f472fc9424 Fix Clang compile warnings. 2014-05-14 21:00:42 +02:00
Jan Vidar Krey 7706e1cb8a Fix copyright year. 2014-05-14 11:39:18 +02:00
Tillmann Karras 8b442018a7 Fix struct mixup 2013-09-06 21:17:43 +02:00
Tillmann Karras fa782e3d2c Fix memleak 2013-09-06 21:17:31 +02:00
Tilka 591d0ba5bb Support certificate chains 2013-09-06 01:44:25 +02:00
Jan Vidar Krey 550740f715 Fix bug #198 - Timers could cause infinite loops
This could essentially happen due to time drift,
high load, or the process being put in sleep for a while.

The reason is that recurring timers could be added to the same time slot
as the timeslot being handled.
2013-03-24 09:47:32 +01:00
Jan Vidar Krey 52211a6bac Updated copyright year. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey f25015927a Clean up white space. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey b81bb2cbd9 Cleaned up all list iterations, added macro named LIST_FOREACH.
Previously you would have to do something like this:

for (type foo = (type) list_get_first(list); foo; foo = (type) list_get_next(list)
{
    /* code */
}

Now, you can instead write this as:

LIST_FOREACH(type, foo, list,
{
    /* code */
})

Basically, boilerplate stuff including the casting is gone.
2013-03-22 00:58:14 +01:00
Jan Vidar Krey 92b65a0e14 Created a connection establishment API.
This API provides transparent asynchronous DNS lookups
with both IPv4 and IPv6 support, and in addition will try
to connect to all addresses until one of them work.

This implements the "happy eyeballs" algorithm provided that the client supports IPv6
and that the DNS records provides both IPv6 and IPv4 addresses.
2013-02-05 22:40:20 +01:00
Jan Vidar Krey 4d438e1e90 Don't poll the connection monitor if there are no connections added.
This caused the backends to return an error code, which
in turn ended the mainloop. However, several other things
also might occur in the main loop, such as DNS lookups which
come prior to creating any connections that in turn would be monitored.
2013-02-05 22:38:13 +01:00
Jan Vidar Krey 2d2ccc0039 Merge branch 'async_dns_api' 2012-11-01 10:42:19 +01:00
Jan Vidar Krey 0a2f9c4b79 Merge branch 'autotest' 2012-11-01 10:40:51 +01:00
Jan Vidar Krey ae62c35cb9 Disable SSL compression. 2012-11-01 10:39:31 +01:00
Jan Vidar Krey 38b19f633d Fix memory leaks and report "host is not found" correctly. 2012-10-25 04:13:05 +02:00
Jan Vidar Krey 470c936e63 Converted the DNS resolver to work with the new threading API abstraction. 2012-10-25 00:40:16 +02:00
Jan Vidar Krey 793790d089 Initial implementation of an async DNS client API with getaddrinfo + pthreads. 2012-10-24 23:19:14 +02:00
Jan Vidar Krey 19559f4974 Make sure we count OpenSSL traffic for the byte IO statistics. 2012-10-18 11:40:18 +02:00
Jan Vidar Krey c50eb90bee Removed the last bits of OpenSSL code called directly 2012-10-17 20:53:05 +02:00
Jan Vidar Krey 1e0927f510 Update copyright year. 2012-10-17 20:00:52 +02:00
Jan Vidar Krey 2f830d3132 Cleaned up error handling. 2012-10-17 15:39:48 +02:00
Jan Vidar Krey 5884983a2f Return -1 as error for recv/send only to signal socket has closed, use a number < -1 for socket errors. 2012-10-17 15:02:32 +02:00
Jan Vidar Krey c43acd97bd Fixed accept/connect state event propagation.
Also removed some unused states and flags.
2012-10-17 09:25:15 +02:00
Jan Vidar Krey b1f2c93738 Reworked the error handling of non-blocking reads and writes.
This should prevent busy loops where the socket is makred readable
but we are really only looking for it to become writable.
2012-10-17 09:16:02 +02:00
Jan Vidar Krey 50912bdf75 More work on splitting out OpenSSL specific bits. 2012-10-15 20:39:03 +02:00
Jan Vidar Krey f3922bb3e0 Work on splitting out OpenSSL cleanly. 2012-10-12 14:24:03 +02:00
Jan Vidar Krey f20c42d05f Wrapped everything OpenSSL related in a SSL_USE_OPENSSL check macro. 2012-10-02 23:59:11 +02:00
Jan Vidar Krey 20a847e1b4 Moved the ipcalc code to the network directory. 2012-10-03 12:59:05 +02:00
Jan Vidar Krey 35bfefa717 Fix debug output typo. 2012-09-27 15:29:19 +02:00
Tilka ccb66ced4f don't show error on SIGTERM in select() backend 2012-05-05 01:10:24 +02:00
Tilka e925db2b98 small cleanup 2012-04-19 02:56:27 +02:00