summaryrefslogtreecommitdiffstats
path: root/lib/tsocket/tsocket_bsd.c
Commit message (Collapse)AuthorAgeFilesLines
* tsocket: Use iov_advanceVolker Lendecke2015-02-241-50/+17
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tsocket: Fix a typoVolker Lendecke2015-02-241-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tsocket: Pass the full port number to getaddrinfo().Andreas Schneider2013-07-011-1/+1
| | | | | | | | | | The code stripped port numbers above 9999 down to 4 digits. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jul 1 21:10:53 CEST 2013 on sn-devel-104
* tsocket: Add some constVolker Lendecke2013-06-141-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tsocket: ENOMEM can be retried on illumos/Solaris.Ira Cooper2013-03-131-0/+6
| | | | | | | | | | The writev system call can return -1 and errno ENOMEM, as a retriable condition. Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 13 23:50:05 CET 2013 on sn-devel-104
* tsocket_bsd: Attempt to increase the SO_SNDBUF if we get EMSGSIZE in sendto()Andrew Bartlett2013-03-041-0/+26
| | | | | | | | | | | | | | This matches what was done for lib/socket/socket_unix.c in c692bb02b039ae8fef6ba968fd13b36ad7d62a72. (and is based on that patch by Landon Fuller <landonf@bikemonkey.org>) Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Mar 4 11:15:35 CET 2013 on sn-devel-104
* lib/tsocket: disable the syscall optimization for recvfrom/readv by defaultStefan Metzmacher2012-11-051-6/+67
| | | | | | | | | We only do the optimization on recvfrom/readv if the caller asked for it. This is needed because in most cases we preferr to flush send buffers before receiving incoming requests. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* lib/tsocket: fix loop in tdgram_bsd_recvfrom() (bug #9184)Stefan Metzmacher2012-10-231-1/+9
| | | | | | | | | | | | | If the socket is not readable yet, we need to retry if tsocket_bsd_pending() returns 0. See also https://lists.samba.org/archive/samba-technical/2012-October/087164.html metze Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Oct 23 14:44:21 CEST 2012 on sn-devel-104
* lib/tsocket: fix receiving of udp packets from 0 bytes (bug #9184)Stefan Metzmacher2012-09-221-4/+1
| | | | | | | | | It's possible for a client to send 0 bytes in a UDP packet, we need still need to call recvfrom() and skip the invalid packet at a higher level. Otherwise the kernel receive queue is blocked. metze
* tsocket: fill in sa.sa_len if the system supports itStefan Metzmacher2010-11-051-0/+12
| | | | metze
* tsocket: let tstream_inet_tcp_connect_recv() optionally return the used ↵Stefan Metzmacher2010-10-231-1/+2
| | | | | | | | | | | | local address tstream_inet_tcp_connect_send() usually only gets no local port number and it may use the wildcard address '0.0.0.0' or '::'. tstream_inet_tcp_connect_recv() provides the used local address and port which are used on the wire. metze
* tsocket: ask the kernel for the specific local address after a tcp connectStefan Metzmacher2010-10-231-3/+54
| | | | metze
* tsocket: make sure we delete the fd event before calling close()Stefan Metzmacher2010-10-041-0/+1
| | | | | | | | | | | | | | We got random double free errors, when getting events from epoll_wait() and try to dereference the private talloc pointer attached to it. Before doing the close() in the tstream_disconnect_send() function we need to delete the fd event. commit 38f505530ba06323a56c7d3914630efffcd12629 only fixed it for tdgram sockets. metze
* tsocket: make sure we delete the fd event before calling close()Stefan Metzmacher2010-09-281-0/+1
| | | | | | | | | | | | | | We got random double free errors, when getting events from epoll_wait() and try to dereference the private talloc pointer attached to it. Before doing the close() in the tstream_disconnect_send() function we need to delete the fd event. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Sep 28 01:02:55 UTC 2010 on sn-devel-104
* tsocket: we return -1 on error, not fdAndrew Tridgell2010-09-151-7/+7
| | | | | | | | | | | | | | | | | | | | | the code used this pattent: if (fd < 0) { ...various cleanups... return fd; } it is much clearer to do this: if (fd < 0) { ...various cleanups... return -1; } as otherwise when reading the code you think this function may return a fd. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* Revert "lib/tsocket: sa_socklen is a macro on irix, so better use sasocklen"Stefan Metzmacher2010-08-281-29/+29
| | | | | | | | This reverts commit 3d4fb698660381e650d7caeb5b7cff12847c0fb8. This was wrong... The problem was in the caller, sa_len is a macro on irix metze
* lib/tsocket: sa_socklen is a macro on irix, so better use sasocklenStefan Metzmacher2010-08-271-29/+29
| | | | metze
* tsocket: Fix some type-punned warningsVolker Lendecke2010-06-211-2/+2
|
* lib/tsocket: add tsocket_address_is_unix() functionStefan Metzmacher2010-04-271-0/+17
| | | | metze
* lib/tsocket: add tsocket_address_is_inet() functionStefan Metzmacher2010-04-271-0/+37
| | | | metze
* Revert "tsocket: not all systems have IPV6_V6ONLY"Stefan Metzmacher2010-04-241-2/+2
| | | | | | | | | This reverts commit 63fc3978089df403d7e63462593784ff3d05e6e7. We now don't support IPv6 when IPV6_V6ONLY isn't available, as we rely on the behavior. metze
* tsocket_bsd: Always use a real length for the sa_socklen, and keep it aroundAndrew Bartlett2010-04-081-68/+16
| | | | | | | | The previous code assumed the OS would happily accept sizeof(struct sockaddr_storage). It seems some versions of Solaris do not like this. Andrew Bartlett
* tsocket: not all systems have IPV6_V6ONLYAndrew Tridgell2010-03-261-2/+2
|
* tsocket/bsd: fix comment in tdgram_bsd_recvfrom_handler()Stefan Metzmacher2010-02-181-2/+4
| | | | metze
* Fix commit d07cd37b993d3c9beded20323174633b806196b5Jeremy Allison2010-02-171-1/+4
| | | | | | | | | | | | | Which was: tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD Metze, this has to have been wrong - you are throwing away the talloc_realloc pointer returned. Also no error checking. Please review. Thank goodness for gcc warnings :-). Jeremy.
* tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREADStefan Metzmacher2010-02-171-4/+6
| | | | metze
* tsocket/bsd: set IPV6_V6ONLY on AF_INET6 socketsStefan Metzmacher2010-02-171-0/+36
| | | | | | | | Some system already have this as default. It's easier to behave the same way on all systems and handle ipv6 and ipv4 sockets separate. metze
* tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote ↵Stefan Metzmacher2010-02-171-2/+53
| | | | | | address if the local address is any metze
* tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in ↵Stefan Metzmacher2010-02-171-1/+1
| | | | | | | | | tstream_bsd_connect_send() This is needed because, we can't use sizeof(sockaddr_storage) for AF_UNIX sockets. Also some platforms require exact values for AF_INET and AF_INET6. metze
* tsocket/bsd: fix do_bind logic for AF_INETStefan Metzmacher2010-02-171-2/+2
| | | | | | We want the explicit bind() when we don't use the any address. metze
* tsocket: only copy the specific part of sockaddr*Stefan Metzmacher2009-12-241-0/+5
| | | | | | | This makes sure we fill the unspefic bytes with 0 and have zero termination for sockaddr_un. metze
* tsocket: allow AF_UNIX sockaddrs smaller than sizeof(sockaddr_un)Stefan Metzmacher2009-12-241-4/+5
| | | | | | | This is needed as getpeername() truncates the length to 2 if the peer socket has no name. metze
* tsocket: Fixed typo in LGPL header.Andreas Schneider2009-12-151-1/+1
|
* tsocket: add tsocket_address_bsd_sockaddr() and ↵Stefan Metzmacher2009-12-151-5/+49
| | | | | | tsocket_address_bsd_from_sockaddr() metze
* tsocket_bsd: return -1 and set errno to ENAMETOOLONG if the unix path is too ↵Stefan Metzmacher2009-11-031-1/+6
| | | | | | long metze
* tsocket: rename sa_len => sa_socklen, because sa_len is a macro on some ↵Stefan Metzmacher2009-07-161-21/+21
| | | | | | platforms metze
* tsocket/bsd: also ask for TEVENT_FD_READ when we want to write into a stream ↵Stefan Metzmacher2009-06-291-2/+9
| | | | | | | | socket Otherwise we would not notice a broken connection. metze
* tsocket/bsd: more correctly check if the cached tevent_fd is still validStefan Metzmacher2009-06-291-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | I some cases the pointer value of tevent_context is the same again, if we do something like: ev1 = tevent_context_init(); ... fde = tevent_add_fd(ev1, fd, TEVENT_FD_READ...); ... talloc_free(ev1); ... ev2 = tevent_context_init(); if (ev1 == ev2) { /* this can happen! */ } if (tevent_fd_get_flags(fde) == 0) { /* this is always true */ } But the "talloc_free(ev1)" will set fde->event_ctx to NULL and tevent_fd_get_flags() will always return 0. metze
* tsocket: allow empty vectors at the end for tstream_writev()/readv()Stefan Metzmacher2009-05-221-0/+26
| | | | metze
* Set errno=ENOMEM if tevent_add_fd failsVolker Lendecke2009-05-191-0/+4
| | | | | | | tevent_add_fd does not properly set that. At least in epoll and select this is the only error condition. Metze, please check!
* Simplify the logic of tsocket_bsd_pendingVolker Lendecke2009-05-191-24/+26
| | | | | | Remove two indentation levels by returning early on error. Metze, please check!
* tsocket: add tstream implementation for bsd sockets (inet and unix)Stefan Metzmacher2009-05-011-0/+900
| | | | metze
* tsocket: rename tdgram_unix_dgram_socket() => tdgram_unix_socket()Stefan Metzmacher2009-05-011-5/+5
| | | | metze
* tsocket: tdgram move input checks to the common code as there're needed for ↵Stefan Metzmacher2009-05-011-22/+1
| | | | | | | | | all backends We need to make sure that we free the sendto and recvfrom requests before the tdgram_context metze
* tsocket: for unix domain sockets we need to use sizeof(struct sockaddr_un)Stefan Metzmacher2009-05-011-2/+22
| | | | | | sizeof(struct sockaddr_storage) generates EINVAL. metze
* tsocket: remove tsocket_context related stuffStefan Metzmacher2009-05-011-674/+13
| | | | | | It will be replaced by tdgram_context and tstream_context. metze
* tsocket: fix the build without ipv6 supportStefan Metzmacher2009-04-161-0/+2
| | | | metze
* tsocket: reduce size of dummy variableStefan Metzmacher2009-04-061-1/+1
| | | | metze
* tsocket: use the correct 'ret' variable for tdgram_disconnect_send/recv()Stefan Metzmacher2009-04-061-8/+2
| | | | metze
* tsocket: remove DGRAM support from tsocket_contextStefan Metzmacher2009-04-021-72/+0
| | | | metze