1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
Commit Graph

51 Commits

Author SHA1 Message Date
Stefan Metzmacher
27195b3ac5 socket_wrapper: correctly handle dup()/dup2() ref counting
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Sep 29 13:13:56 CEST 2011 on sn-devel-104
2011-09-29 13:13:56 +02:00
Stefan Metzmacher
a110d05f67 socket_wrapper: pass down the fd explictly from the swrap_*() to the real_*() calls
metze
2011-09-29 10:27:15 +02:00
Volker Lendecke
120b1392d3 swrap: Fix a c++ warning 2011-09-18 17:24:22 +02:00
Andrew Tridgell
63e5b395d0 socket-wrapped: added wrappers for dup() and dup2()
The Samba4 standard process model uses dup() on incoming sockets as an
optimisation (it makes select() a tiny bit faster when used).

Adding dup() to socket wrapper allows us to use the standard process
model in selftest

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-12 09:38:26 +02:00
Stefan Metzmacher
86b7b5cd96 socket_wrapper: make sure interfaces are in the valid range on bind()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Jul 10 18:24:14 CEST 2011 on sn-devel-104
2011-07-10 18:24:14 +02:00
Andrew Bartlett
29d8c597fc lib/socket_wrapper: allow up to 32 interfaces for a bigger 'make test'
The combined s3/s4 'make test' needs more interfaces.

Andrew Bartlett
2011-04-19 10:03:49 +10:00
Stefan Metzmacher
a29999392a socket_wrapper: fix handling of addr and addrlen
metze
2011-03-09 12:27:25 +01:00
Stefan Metzmacher
2c7c3d03d5 lib/socket_wrapper: try to fix the build on solaris
struct msg does not contain msg_control, msg_controllen and msg_flags
on solaris.

metze
2011-03-04 21:19:05 +01:00
Stefan Metzmacher
a5d54579ea socket_wrapper: use swrap_sendmsg_before()/after() in swrap_writev()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Mar  3 23:43:39 CET 2011 on sn-devel-104
2011-03-03 23:43:39 +01:00
Stefan Metzmacher
e831376f91 socket_wrapper: use swrap_sendmsg_before()/after() in swrap_sendmsg()
This also adds the same logic for broadcast as in swrap_sendto()
for SOCK_DGRAM.

metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
4a736f0fbe socket_wrapper: use swrap_sendmsg_before()/after() in swrap_send()
metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
a2db6b4dba socket_wrapper: use swrap_sendmsg_before()/after() in swrap_sendto()
metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
8c6d7d7b27 socket_wrapper: add swrap_sendmsg_before/after helper functions
Currently have almost the same logic in swrap_send(), swrap_sendto(),
swrap_writev() and swrap_sendmsg(), this helper functions
let combine all the logic in 2 places.

metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
ec028b555b socket_wrapper: readv() should only work on connected sockets
metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
7bdc3db9ea socket_wrapper: move swrap_ioctl() above the send*/recv* functions
metze
2011-03-03 22:57:26 +01:00
Stefan Metzmacher
0ad8d459c6 socket_wrapper: fix compiler warnings
metze
2011-03-03 22:57:25 +01:00
Stefan Metzmacher
e3c0d66110 socket_wrapper: don't allow connect() to the broadcast address
This will simplify other code later.

metze
2011-03-03 22:57:25 +01:00
Volker Lendecke
7852527073 Fix some nonempty blank lines 2011-02-13 12:11:52 +01:00
Günther Deschner
2f6d76a95f socket_wrapper: avoid c++ style comments.
Seen on the aix s3-waf build where it causes the build to fail.

Guenther
2011-02-10 15:29:37 +01:00
Stefan Metzmacher
c1e3c8b550 socket_wrapper: fill in sa.sa_len if the system supports it
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Nov  5 14:40:00 UTC 2010 on sn-devel-104
2010-11-05 14:40:00 +00:00
Stefan Metzmacher
9b9489479e socket_wrapper: Make it work on freebsd for udp packets
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Oct 10 12:57:00 UTC 2010 on sn-devel-104
2010-10-10 12:56:59 +00:00
Stefan Metzmacher
0922c5ab2d Revert "socket-wrapper: not all systems have FIONREAD defined"
This reverts commit 710aa773d5.

We rely on FIONREAD in a lot of other parts in the code,
so there's no need to have an ifdef for it in the socket_wrapper code.

On tru64 FIONREAD is defined in <sys/ioctl.h>
and we include <sys/ioctl.h> via "system/network.h".

Tridge: maybe a HAVE_SYS_IOCTL_H was missing at the time you tried
it on tru64?

If we find a platform that doesn't support it,
we need to bail out at configure time or
provide a replacement in libreplace.

metze
2010-04-08 08:34:39 +02:00
Andrew Tridgell
710aa773d5 socket-wrapper: not all systems have FIONREAD defined
tru64 for example
2010-04-03 13:31:12 +11:00
Stefan Metzmacher
0b3e950731 socket_wrapper: also ignore AF_INET6 in swrap_setsockopt()
metze
2010-02-17 14:13:55 +01:00
Stefan Metzmacher
4b6e9a8e49 socket_wrapper: swrap_read() should use SWRAP_RECV* for swrap_dump_packet()
This is the same as swrap_recv().

metze
2009-09-08 22:07:30 +02:00
Jeremy Allison
5ce12a0565 Add read() to socketwrapper. Metze please check.
Jeremy.
2009-09-07 20:31:01 -07:00
Andrew Bartlett
17e1cbb6d3 Partially revert restriction of socket_wrapper to 1500 byte writes
This keeps the restriction for stream sockets (where the caller will
retry), without creating problems on datagram sockets (CLDAP is not
defined, as far as I know, across multiple UDP packets).

The commit adding this restriction was
47b106c0ae

Andrew Bartlett
2009-06-19 14:36:06 +10:00
Andrew Tridgell
03dd06de9a fixed socket wrapper to determine family from the right structure
In convert_in_un_remote() the socket family can be accessed either as
si->family or inaddr->sa_family. We were using the si->family to
determine how to cast the inaddr structure, but if si->family !=
inaddr->sa_family then we will incorrectly be casting a in6 structure
as in4 or vice-versa.
2009-06-09 13:33:09 +10:00
Andrew Bartlett
4c70a5b405 socket_wrapper Cope with SOCK_CLOEXEC and SOCK_NONBLOCK flags
Heimdal will, on supporting systems, set these flags in the type
argument of socket(), causing breakage when combined with
socket_wrapper.

For background on these flags, see http://lwn.net/Articles/281965/

Andrew Bartlett
2009-06-04 14:19:17 +10:00
Andrew Bartlett
8603985575 Add support for sendmsg() in socket_wrapper
This is required because the deferred connect code skips the connect()
until sending the packet, but unless we catch this call, the connect()
never happens.

Andrew Bartlett
2009-05-26 12:37:09 +10:00
Stefan Metzmacher
74707e8e8e socket_wrapper: fix the build on systems without ipv6 support
metze
2009-04-14 12:47:18 +02:00
Stefan Metzmacher
f20f5ae8e6 socket_wrapper: fix crash bug in swrap_readv/writev
metze
2009-04-10 19:38:29 +02:00
Stefan Metzmacher
435a0a5a3b socket_wrapper: fix connect() for dgram sockets, if the destination isn't there yet
Now we defer the real_connect() for dgram sockets to the first send()/sendto() call,
as the destination might not be there at connect time.

Commit 66dc53ee01 was an incomplete fix for this
problem.

metze
2009-03-23 12:19:29 +01:00
Stefan Metzmacher
1f72e4abfd Revert "socket_wrapper: fix connect() for dgram sockets, if the destination isn't there yet"
This reverts commit 66dc53ee01.

Somehow this leads to timeouts in some tests, samba4.ldb.ldapi
and samba4.rpc.schannel. I need to look at it more closely later...

metze
2009-03-22 12:36:38 +01:00
Stefan Metzmacher
66dc53ee01 socket_wrapper: fix connect() for dgram sockets, if the destination isn't there yet
metze
2009-03-21 10:44:40 +01:00
Stefan Metzmacher
143b222546 socket_wrapper: wrap readv() and writev()
metze
2009-03-10 08:15:48 +01:00
Stefan Metzmacher
5ff4cb580f socket_wrapper: try to make ipv6 support more portable
The internal structure of in6_addr isn't always the same.

metze
2009-03-09 10:21:30 +01:00
Stefan Metzmacher
3679e82434 socket_wrapper: downgrade ipv6 sockets to ipv4 is in connect() if the dest is ipv4
We only do this if the socket isn't explicit bound yet.

metze
2009-03-08 17:22:26 +01:00
Stefan Metzmacher
f9156f6c77 socket_wrapper: correctly handle connected dgram sockets
metze
2009-03-08 17:22:25 +01:00
Stefan Metzmacher
81e2633e41 socket_wrapper: make it possible to bind to '::'
metze
2009-03-08 15:18:05 +01:00
Tim Prouty
f9636b0c01 socket wrapper: Fix 'might be used uninitialized' warning 2009-03-04 12:59:16 -08:00
Stefan Metzmacher
27cf23958b socket_wrapper: add multiple interface support for ipv6
We use FD00::5357:5FXX in the same way we use 127.0.0.XX

metze
2009-03-04 08:32:33 +01:00
Stefan Metzmacher
b99bb962aa socket_wrapper: add ipv6 pcap support
metze
2009-03-04 08:32:33 +01:00
Stefan Metzmacher
8ae34cc994 socket_wrapper: pass down sockaddr instead of sockaddr_in to prepare pcap support for ipv6
metze
2009-03-04 08:32:32 +01:00
Stefan Metzmacher
40da086fe0 socket_wrapper: prepare pcap support for ipv6 traffic
metze
2009-03-04 08:32:32 +01:00
Stefan Metzmacher
c51e5a23fb socket_wrapper: don't crash if we get EAGAIN from real_recv()
This fixes a crash in the ldaps tests with socket wrapper pcap support.

metze
2009-03-04 08:32:31 +01:00
Stefan Metzmacher
bd576b93bd socket_wrapper: fix PCAP support broken by aaea68791c
We should note close the fd after writing the first packet.

metze
2009-01-20 00:42:01 +01:00
Jeremy Allison
aaea68791c In gcc version 4.3.2 we get warnings for functions declared with
attribute warn_unused_result. Start to fix these.
Jeremy.
2008-12-22 20:08:14 -08:00
Tim Prouty
abf00f710d Changed variable name from f19086872e to match v3-[23]-test 2008-10-07 11:00:54 -07:00
Tim Prouty
f19086872e Fixed "declaration shadows global declaration" warnings.
The patch simply uses a more descriptive variable name for tcp_seq.

../lib/socket_wrapper/socket_wrapper.c:753: warning: declaration of 'tcp_seq' shadows a global declaration
/usr/include/netinet/tcp.h:40: warning: shadowed declaration is here
../lib/socket_wrapper/socket_wrapper.c: In function `swrap_marshall_packet':
../lib/socket_wrapper/socket_wrapper.c:919: warning: declaration of 'tcp_seq' shadows a global declaration
/usr/include/netinet/tcp.h:40: warning: shadowed declaration is here
2008-10-06 17:13:28 -07:00