Andre Noll [Mon, 7 Jan 2008 15:27:31 +0000 (16:27 +0100)]
Fix configure on Solaris.
Without this patch, configure fails on Solaris because it doesn't find
inet_ntoa() and socket(). These are in libnsl and libsocket
respectively, but AC_CHECK_FUNCS() doesn't know this.
Andre Noll [Sat, 29 Dec 2007 20:43:13 +0000 (21:43 +0100)]
Simplify para_basename().
No need to allocate additional memory. This saves a malloc/free
in the hot path of com_ls(), the only caller. Also take care for
the case basename == NULL.
Gerrit Renker [Mon, 17 Dec 2007 12:12:25 +0000 (13:12 +0100)]
02_HTTP_access-list.diff
After adding IPv6 support the access list matching routine was left in
a broken state. This patch fixes the problem by continuing the support
for IPv4 address/netmask access lists.
The following problems are fixed:
* support for a server listening to both IPv6 (AF_INET6) and IPv4 (AF_INET)
address (since one can not assume that the server's address has AF_INET);
* explicit support for addresses in network-byte-order (without having to reverse
the netmask);
* a routine to extract v6-mapped IPv4 addresses ("::FFFF:x.x.x.x") for IPv4
clients connecting to a (dual-stack) IPv6 server.
When the access list is in use, the connection mode is automatically switched to
IPv4, i.e. IPv6 clients connecting to the server will be treated as if they were
in the deny-list.
Gerrit Renker [Mon, 17 Dec 2007 12:12:25 +0000 (13:12 +0100)]
01_DCCP_shutdown-unnecessary.diff
This calls shutdown(2) for unused communication paths in the DCCP sender/receiver:
* the sender does not read data from the client and so calls shutdown(SHUT_RD);
* the client does not send data to the server and so calls shutdown(SHUT_WR).
The advantage that this buys is a performance optimisation: using shutdown(2) in
DCCP means disabling the corresponding CCID kernel modules, which reduces the
processing costs, i.e.
* when using SHUT_RD, the receiver congestion-control module is de-activated;
* when using SHUT_WR, the sender congestion-control module is de-activated.
More information can be found on
http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/shutdown/
Andre Noll [Sat, 15 Dec 2007 16:01:47 +0000 (17:01 +0100)]
Replace eof by error in receivers/filters/writers.
This way it's possible to tell at a later time why
the receiver/filter/writer terminated.
This allows to increase the delay for reconnecting in case
the receiver failed to connect to para_server: Let the receivers
set the error value to -E_RECV_EOF in case a normal end of file
event occurred and check this value when calculating the restart
barrier.
Andre Noll [Tue, 11 Dec 2007 16:48:11 +0000 (17:48 +0100)]
Makefile.in: Avoid gcc warnings on non-linux systems.
-fdata-sections, -ffunction-sections, -Wl,--gc-sections, -Wstrict-prototypes
and -Wshadow produce quite a lot of warnings on at least NetBSD and MacOS. So
use these flags only on Linux.
Andre Noll [Tue, 11 Dec 2007 16:42:24 +0000 (17:42 +0100)]
Fix SIGUSR1 handling on Solaris.
para_client dies the second time it receives SIGUSR1, because the signal action
is restored to the default state once the signal handler has been called.
Andre Noll [Mon, 3 Dec 2007 16:25:30 +0000 (17:25 +0100)]
Fix compilation on NetBSD.
At least on NetBSD-3.1, AI_V4MAPPED, AI_ALL, and AI_ADDRCONFIG
are all undefined. The fix is to #define these to zero if they
are not defined in netdb.h. This means that no hints will be
given in this case which is the best we can do.
Gerrit Renker [Fri, 30 Nov 2007 09:23:51 +0000 (10:23 +0100)]
06_Unix-Domain-Sockets.diff
[LOCAL SOCKETS]: Tidy up and share common code
This patch just suggested itself - after all the other changes have been made,
the only remaining customers of PARA_CONNECT were the Unix domain sockets.
The patch generates a counterpart to create_local_socket(), for the peer talking
over a Unix domain socket.
Gerrit Renker [Fri, 30 Nov 2007 09:23:51 +0000 (10:23 +0100)]
03_TCP-socket-functions.diff
This converts the control connection and the HTTP streaming module to use the makesock() interface.
The specific changes are:
* replace tcp_connect() directly with makesock();
* replace tcp_listen() with para_listen() (in turn a wrapper around makesock());
* init_sockaddr() becomes obsolete;
* replaced use of sockaddr_in in para_accept() with NULL sockaddr argument
-- the `remote' name of the socket is always available via getpeername(2),
-- this is exploited by replacing the reverse-name lookup with remote_name();
* the sockaddr_in field `addr' of `struct http_client' has been replaced with `name' string
-- name is filled in as in para_accept() above, using remote_name(),
-- unlike above, the remote_fd() call can later not be done, due to close_listed_fds().
The one thing I am really not sure about is host_in_access_perm_list():
* It needed to be converted to allow address-independent HTTP streaming.
* The conversion represents the obvious choice for doing this.
* However, I have not (yet) tested it.
* A problem that may arise is that when listening using AF_UNSPEC then _all_ addresses appear
as IPv6 addresses (i.e. the test "family == AF_INET" would never hold true). In this case,
a possible solution is to switch between AF_UNSPEC and AF_INET dependint on whether the
configurable access-list is empty or non-empty, respectively.
* A possible place for this chance would be http_send_init() or any other function calling
open_tcp_port().
Gerrit Renker [Fri, 30 Nov 2007 09:23:51 +0000 (10:23 +0100)]
02_Reverse-lookup-support.diff
In some parts of the code a reverse-lookup (e.g. "connection from xxx") is used.
An address-family independent reverse-lookup function is provided by this patch,
exploiting that a socket is described by {src addr, src port, dst addr, dst port}:
* host_and_port(): prints host and port number of given socket,
* local_name(): pretty-prints src-addr/src-port,
* remote_name(): pretty-prints dst-addr/dst-port;
Gerrit Renker [Fri, 30 Nov 2007 09:23:51 +0000 (10:23 +0100)]
01_IPv6-Basic-Support.diff
This patch provides an algorithm which, given a hostname and a numeric port identifier,
will look up all matching IPv4/IPv6 addresses and either bind it (for passive sockets)
or connect to it (for active sockets).
Certain socket options need to be set before a connection is established. Since in
paraslash the demand for such options is not very big at this time, the only present
case (setting SO_REUSEADDR on passive sockets) has been integrated into the main loop.
A more sophisticated variant for setting pre-connection socket options exists and is
available as part of the DCCP library. The current solution is extensible, i.e. if one
wants to later add more options, the alternative (more sophisticated approach) can be
used. But for now, that would just have meant code bloat.
The subsequent patches in this set will step by step replace the old infrastructure
with the use of this algorithm.
Andre Noll [Sun, 25 Nov 2007 22:28:09 +0000 (23:28 +0100)]
com_addatt: Minor improvements.
- Use get_attribute_bitnum_by_name() instead of open-coding.
- Use new error code E_ATT_TABLE_FULL.
- Move definition of objs[ATTCOL_NAME] down to where it is needed.
- Kill FIXME comment: We can not use find_greatest_att_bitnum() here.
Andre Noll [Sun, 25 Nov 2007 12:36:37 +0000 (13:36 +0100)]
Introduce tcp_connect().
This replaces get_host_info(). The two callers of the latter,
client_connect() and http_recv_open(), did exactly the same, namely
initializing a struct sockaddr_in which was then used for PARA_CONNECT().
So move this common code to tcp_connect(). Additional benefit of this
is that the only remaining callers of init_sockaddr() are in net.c, so
make this function static.
Andre Noll [Sun, 25 Nov 2007 11:08:24 +0000 (12:08 +0100)]
Get rid of E_SEND.
This patch also simplifies sendall() a bit and fixes two bugs in
add_one_audio_file():
- If the check for existence of a hash sister failed, we missed
to unmap the audio file.
- If an error occurred we send out a message to the client. If
this message can not be sent (because the client terminated
the connection) we returned success anyway and happily
tried to add the next audio file.