Compile with -Wsuggest-attribute=malloc. We already employ this attribute extensively to help the compiler improve optimization. However, a few malloc-like functions were not yet marked with __malloc. Fix that and enable the warning to make sure that new malloc-like functions get marked. Since not all supported compilers know about this warning option, we need to check at compile time whether the option is supported. Thanks to the existing cc-option make(1) function, this is a simple one-liner for Makefile.real.
net: Pass true/false instead of 0/1 to makesock(). The function receives a boolean argument, after all.
net: Rename para_connect_simple() -> para_connect(). We used to have para_connect() at some point (hence the need for the _simple suffix), but it was removed long ago.
net: Make is_valid_ipv{4,6}_address() local to net.c. These inline functions are only used in net.c, so they do not need to be declared in net.h. De-doxyfy their documentation because static functions don't need doxygen comments.
net: Remove IPPROTO_DCCP define. This macro is defined in the system headers on all moderately new Linux versions, FreeBSD-13 and NetBSD-9, so our local fallback is not needed anymore.
net: Make single-use macros local. A few macros are defined in net.h but are only used in a single C file. Move those to where they are used to make the code easier to follow. DCCP_SOCKOPT_RX_CCID is not used at all, so remove that.
net: Combine documentation of struct flowopts. It was documented both in net.h and net.c.
net: Drop extern keyword of function declarations. It has no effect.
net: Drop fd_set parameter from para_accept(). As for read_nonblock(), the parameter is dispensable because it is only used for an optimization to avoid a system call. Get rid of it because it hinders the conversion from select(2) to poll(2).
server: Add --http-listen-address and --dccp-listen-address. Currently the http and the dccp sender accept connections on all IP addresses. This commit makes it possible to configure the senders to listen only on the specified subset of addresses. To make this work, the sender_status structure has to be extended to store an array of file descriptors rather than just a single one. Several places need to iterate over all listening sockets of the sender. The new FOR_EACH_LISTEN_FD macro helps to avoid duplicating the corresponding loop. The status part of the sender command now prints the listening addresses instead of just on/off. This is why we also maintain the ascii representation of the listening addresses in the sender_status structure and introduce the format_url() helper to format host/port pairs.
server: Implement --listen-address for control service. For hosts with multiple IP addresses one might want to configure the listening sockets so that connections can only arrive on a subset of the host's addresses. This patch implements this feature. Unlike para_listen_simple() the new para_listen() receives an optional argument to let the caller specify the listening address in addition to the port number. para_listen_simple() is now a simple wrapper that passes a NULL pointer as the new argument which indicates that the socket should listen on all local addresses, just like prior to this change. The set of listening addresses for the control service of para_server can be specified via the new --listen-address option. This option can be given multiple times, once for each listening address. Due to this change the server needs to maintain more than a single file descriptor to dispatch incoming connections. Hence the integer ->listen_fd of struct server_command_task has to be replaced by an array of file descriptors and the {pre,post}_select methods of the command task have iterate over all descriptors in the array. The meaning of the --port option has changed due to the new option: since the argument to --listen-address can also contain a port number, the argument to --port is only used for addresses with no port number, or if --listen-address is not given at all. Although the http and dccp senders also open a listening socket, this commit affects only the control service of para_server (listening on TCP 2990 by default). Senders will be covered in the next commit.
Move MAX_HOSTLEN from server.h to net.h. This generic networking-related constant does not belong to server.h. However, since server.h uses the constant, we have to make sure that net.h is included before server.h.
net: Combine para_listen() and para_listen_simple(). The only caller of para_listen() is para_listen_simple(), since flowops are only used for active sockets.
Shorten copyright notice. The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
doxygen: Trivial cleanups. A couple of capitalization and punctuation fixes.
Remove compatibility code for abstract unix domain sockets. Abstract sockets were introduced in paraslash-0.5.5 (2015-09-20). For backwards compatibility, create_local_socket() was modified to create an abtract socket *and* an ordinary pathname socket so that old audiod clients (which connect to the pathname socket) would still work. This patch breaks compatibility by going back to a single socket, either abstract (Linux) or pathname (all other systems), as determined in the first call to create_local_socket(). This allows to drop the "abstract" argument of init_unix_addr() and the "mode" argument of create_local_socket(). The code in net.c and the callers get quite a bit shorter since it has to deal with only a single file descriptor and one type of socket.
Remove socket address parameter of create_local_socket(). The two callers of create_local_socket() are not interested in the sockaddr_un structure at all. So we may define the structure in create_local_socket() rather than in each caller, and kill the function parameter.
Update year in copyright headers. Done with files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files In previous years we ran a similar script to set the second year in the range to the current year. This is kind of silly, so let's get rid of this useless information. This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in all file headers, i.e. only the first year (A) is left in. Accurate information including time stamps for each change can be obtained from the git history.
net.c: Remove unused local_name(). Found by cppcheck.
doc: Change email address to maan@tuebingen.mpg.de The mail server on systemlinux.org was down for more than a week lately, so let's use an alternative official address. This commit changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de. Most .c and .h files contain the email address in the copyright header, so they must all be patched. Three other files contain the address for a different reason: * README lists email and git, gitweb and home page URLs * configure.ac needs it for configure -h * version.c contains it for the -V option of all commands