summaryrefslogtreecommitdiffstats
path: root/common/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-30Do not use else after return or break for better code readabilityGravatar Rosen Penev1-7/+7
[clang-tidy] Found with readability-else-after-return Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-27socket: Fix build on WindowsGravatar Nikias Bassen1-1/+308
2020-09-16common: Increase timeout for socket_send() to reasonable valueGravatar Nikias Bassen1-1/+2
The short timeout of 1000 ms might cause problems in different situations like a firmware restore, where 1000 ms can easily be hit. Increasing this to a higher value will mitigate it for this case, but actually the error handling at a higher level needs to be improved.
2020-06-08socket: Fix IPv6 scope id lookup logic to handle another network device problemGravatar Martin Szulecki1-2/+12
The lookup logic preferred to return the last suitable scope id match. This became a problem if there was already a suitable scope id match before that was higher in the interface list. This now chooses the higher last scope id interface match and thus probably in the routing preference.
2020-06-07socket: Fix socket_connect_addr() not connecting using IPv6 in some casesGravatar Martin Szulecki1-0/+125
This extends the socket helper with functions to determine the "scope" and a suitable "scope id" of an IPv6 address. While socket_connect_addr() prefers any initially supplied "scope id" to maintain routing information if possible, it will attempt to determine the best suitable route with the new helpers. This became a requirement during testing with remote usbmux connections that provide a different "scope id" and thus might cause IPv6 routing to not work at all. Thus the "scope id" is only valid per host.
2020-06-07socket: Improve socket_create() with proper use of getaddrinfoGravatar Nikias Bassen1-95/+58
2020-05-28socket: Increase listen socket backlog queue lengthGravatar Nikias Bassen1-2/+2
2020-05-28iproxy: Allow specifying source address for the listening socketGravatar Nikias Bassen1-15/+79
2020-05-18socket: Make sure fd is ready to write before calling send()Gravatar Nikias Bassen1-0/+4
2020-05-18socket: Add new functions socket_connect_addr() and socket_addr_to_string()Gravatar Nikias Bassen1-10/+183
2020-05-15socket: Make connecting sockets non-blockingGravatar Nikias Bassen1-11/+31
2019-08-03win32: Fix compilationGravatar Nikias Bassen1-0/+3
2019-06-13socket: Return -ETIMEDOUT when select() in socket_read_fd() reached the timeoutGravatar Nikias Bassen1-0/+4
2019-05-21socket: Return -ECONNRESET from socket_receive_timeout() instead of -EAGAIN ↵Gravatar Nikias Bassen1-1/+5
if peer closed the socket Returning -EAGAIN would indicate the caller can try again, but if the peer closed the socket that wouldn't make any sense. Thanks to sctol for reporting.
2019-05-21socket: Move initialization of timeval structure into retry loop in ↵Gravatar Nikias Bassen1-8/+7
socket_check_fd() Depending on the platform, select() may modify the timeval structure to indicate the amount left on the timer, so we reset the timeout before calling select() again. Thanks to sctol for reporting.
2018-10-21socket: Make sure to use socket_close() really everywhereGravatar Nikias Bassen1-1/+1
2018-10-19Use socket_close instead of close to close a socketGravatar Frederik Carlier1-1/+1
2018-10-14Allow using non-standard usbmuxd socket address via environment variableGravatar Nikias Bassen1-31/+82
By using USBMUXD_SOCKET_ADDRESS environment variable, it is possible to make libusbmuxd connect to the specified address. The value needs to be in format ADDRESS:PORT (or UNIX:PATH on unix systems). If no port number is specified or parsing fails, the standard socket address (or unix domain socket file path) will be used silently.
2018-09-25Fix compile warningsGravatar BALATON Zoltan1-4/+4
2018-07-24common: Get rid of offsetof() and just use sizeof() to get size of unix ↵Gravatar Nikias Bassen1-21/+6
socket address
2018-05-15socket: Set socket options for usbmux connection to improve performanceGravatar Nikias Bassen1-0/+23
2015-12-29common: [security fix] Make sure sockets only listen locallyGravatar Joshua Hill1-2/+2
2014-10-03Move socket and collection functions to a convenience libraryGravatar Chow Loong Jin1-0/+435
This avoids the iproxy tool from relying on undocumented library ABI.