summaryrefslogtreecommitdiffstats
path: root/src/socket_wrapper.c
Commit message (Collapse)AuthorAgeFilesLines
...
* swrap: Fix buliding on unix systems without AF_NETLINKAndreas Schneider2016-03-021-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Use calloc() instead of malloc and memsetAndreas Schneider2016-02-241-6/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Allow to open NETLINK sockets when loadedAndreas Schneider2016-02-241-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Automatically bind an ephemeral port if neededAndreas Schneider2015-11-041-0/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add a wrapper for write()Andreas Schneider2015-10-281-0/+60
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix recvmsg() with UDPAndreas Schneider2015-10-271-0/+10
| | | | | | | | | | | This worked if the unix path was bigger than sizeof(struct sockaddr_in6). With a short unix socket pathname the buffer was to small to store the address and convert_un_in() failed. Thanks to Grigorij Demidov <grigorii.demidov@nic.cz> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix compare of signed and unsigned integer expressionsAndreas Schneider2015-10-191-2/+4
| | | | | | | | Make sure the values are compared as the same type. iov_len is size_t on Linux and int on Solaris. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Simplify cmspace calculation in swrap_sendmsg_copy_cmsg()Ralph Boehme2015-10-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | With cmsg->cmsg_len = CMSG_LEN(len) => CMSG_ALIGN(cmsg->cmsg_len) = CMSG_ALIGN(CMSG_LEN(len)) = CMSG_ALIGN(CMSG_ALIGN(sizeof(struct cmsghdr)) + len) = CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len) = CMSG_SPACE(len) = CMSG_SPACE(CMSG_ALIGN(sizeof(struct cmsghdr)) + len - CMSG_ALIGN(sizeof(struct cmsghdr))) = CMSG_SPACE(CMSG_LEN(len) - CMSG_ALIGN(sizeof(struct cmsghdr))) = CMSG_SPACE(cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) :) Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Add support for TCP_NODELAY in getsockopt()Andreas Schneider2015-10-141-0/+23
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add support for TCP_NODELAY in setsockopt()Andreas Schneider2015-10-141-0/+30
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Call dlclose() in the destructorAndreas Schneider2015-08-171-0/+7
| | | | Signed-off-by: Andreas Schneider <asn@samba.org>
* swrap: Fix signed comparsion warningsAndreas Schneider2015-08-171-2/+2
| | | | Signed-off-by: Andreas Schneider <asn@samba.org>
* swrap: Add enviornment variable to specify mtu sizeAndreas Schneider2015-08-111-12/+50
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix TCP support with sendmsg/recvmsgAndreas Schneider2015-08-111-5/+10
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Correctly update the msg_name in recvmsg()Andreas Schneider2015-08-111-13/+30
| | | | | | | This has been found while debugging nsupdate. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: If we remove the socket_info also unlink the unix socketAndreas Schneider2015-02-181-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Do not leak the socket_info we just removed.Andreas Schneider2014-10-241-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* src: Add support for running with address sanitizer.Andreas Schneider2014-10-201-0/+8
| | | | | | | | It address sanitzer will complain about our hack with variable function attributes. This disables the checking of it. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* swrap: Fix the loop for older gcc versions.Andreas Schneider2014-10-011-2/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add support for eventfd with unsigned count variable.Andreas Schneider2014-10-011-0/+4
| | | | | | | The prototype in glibc 2.20.90 changed. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add a trace message for swrap_socket().Andreas Schneider2014-10-011-0/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Implement fcntl() to catch F_DUPFD.Andreas Schneider2014-10-011-1/+86
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Include the function name in the debug output.Andreas Schneider2014-10-011-11/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix out of bound access.Andreas Schneider2014-09-031-1/+1
| | | | | | | CID #72659 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Silence alignment warnings.Andreas Schneider2014-09-021-16/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix type punning warnings when loading functions.Andreas Schneider2014-09-021-1/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix access to struct members in log messages.Andreas Schneider2014-09-021-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix whitespace errors.Andreas Schneider2014-09-011-16/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Update copyright notice.Andreas Schneider2014-09-011-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Wrap fopen to detect stale file descriptors.Andreas Schneider2014-09-011-0/+31
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Use swrap_address in swrap_accept().Andreas Schneider2014-09-011-28/+23
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Remove unused sockaddr_dup() function.Andreas Schneider2014-09-011-7/+0
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Use swrap_address in the socket_info struct.Andreas Schneider2014-09-011-107/+109
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Use a sockaddr_un for the unix path in socket_info.Andreas Schneider2014-09-011-5/+7
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Rename swrap_pcap_dump_packet().Andreas Schneider2014-09-011-29/+29
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Rename swrap_pcap_get_fd().Andreas Schneider2014-09-011-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Rename swrap_marshall_packet().Andreas Schneider2014-09-011-8/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Rename swrap_packet_init().Andreas Schneider2014-09-011-15/+22
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Rename socket_wrapper_pcap_file().Andreas Schneider2014-09-011-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix type punning warnings.Andreas Schneider2014-09-011-75/+127
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Provide a compatible declaration of CMSG_ALIGNJakub Hrozek2014-07-291-1/+1
| | | | | | | | | Some platforms (like OSX) do support some of the CMGS macros, but don't have a CMSG_ALIGN macro of their own. Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* SO_PROTOCOL is platform-dependentJakub Hrozek2014-07-291-0/+3
| | | | | | | | | SO_PROTOCOL is not defined on all platforms. In particular, OSX doesn't include it and so far I haven't found any compatible declaration. Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: fix another discard const warning in swrap_bind()Michael Adam2014-07-091-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: fix discard const warning in swrap_bind()Michael Adam2014-07-091-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: fix discard const warning in swrap_remove_stale()Michael Adam2014-07-091-2/+2
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: fix build when neither HAVE_STRUCT_IN_PKTINFO nor IP_RECVDSTADDR is ↵Michael Adam2014-07-091-2/+1
| | | | | | | defined Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Disable incomplete bind checks for EADDRINUSE.Andreas Schneider2014-06-051-1/+6
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: check whether an address:port is already in use in swrap_bind()Michael Adam2014-06-011-0/+7
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: implement check_addr_port_in_use()Michael Adam2014-06-011-0/+83
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: fix AF_UNSPEC special case in swrap_bind()Michael Adam2014-06-011-0/+20
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>