| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
| |
Thanks to the previous patch, the function is only called from udp_send.c,
so move it there, along with its dependencies in net.c. To accomplish this,
we have to make ss_is_addr_v4mapped() public. Since it is very small, it's
easiest to move it to net.h as a static inline function.
|
| |
|
|
|
|
|
|
| |
Generated with
sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h
followed by manually tweaking the result a bit. No license change intended.
|
| |
|
|
| |
It's only needed there.
|
| |
|
|
|
|
|
|
|
|
|
| |
This removes all traces of dccp, specifically dccp_recv.c and dccp_send.c.
The flowops related functions of net.c can go away as well, as flowops were
only needed for the dccp transport. A few other functions are simplified by
dropping the flowops or protocol parameter.
Further cleanups are possible, but are deferred to subsequent commits. In
particular, some functions of send_common.c are only called by the http
transport now. These can be moved to http_send.c and then be made static.
|
| |
|
|
|
|
| |
Only para_audioc needs the former, and only para_audiod needs the latter.
With this patch in place, both functions can be static and the other
executables which link in net.o don't get bloated with unnecessary code.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
The function receives a boolean argument, after all.
|
| |
|
|
|
| |
We used to have para_connect() at some point (hence the need for the
_simple suffix), but it was removed long ago.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
It was documented both in net.h and net.c.
|
| |
|
|
| |
It has no effect.
|
| |
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
| |
The only caller of para_listen() is para_listen_simple(), since
flowops are only used for active sockets.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
}'
|
| |
|
|
| |
A couple of capitalization and punctuation fixes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Found by cppcheck.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Various fixes, improvements, cleanups. Cooking since 2014-02-22.
* t/misc: (29 commits)
build: Don't link with -lreadline if readline was not found.
audiod: Skip NULL pointer check in compute_time_diff().
audiod: Make compute_time_diff() return void.
com_stat(): Remove pointless uptime variable.
gcrypt: Fix gcc warning on Ubuntu Lucid.
flac: Try to link also without -logg.
version.c: Fix comment of version_single_line().
doxygen: Expand all macros, in particular config.h.
recv_common.c: Improve documentation of check_receiver_arg().
audiod: get_time_string() comment fix.
configure: Really print opus audio file handler if opus lib was found.
Overhaul doxygen main page.
afs.h: Don't try to list all supported audio formats.
Change copyright year to 2014.
Add link to sideband.h in doxygen main page.
Doxify error2.c and add GPL header.
Add -Wdeclaration-after-statement.
Add some missing includes.
Makefile.real: Add clean2 to the list of phony targets.
mood.c: Fix a trivial whitespace issue.
...
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This year, we're really on time. The changes in this patch were
created by the following silly script:
files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll')
sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files
sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds a new filter for synchronization between clients. It works
by sending an UDP packet to other clients ("buddies").
To reduce latency, address resolution is only performed once on
startup. Hence lookup_address() and makesock_addrinfo() of net.c
are made public.
This commit introduces new public function sockaddr_equal() in
net.c which compares two IPv4 or IPv6 addresses. It is used in
sync_find_buddy().
|
| |/
|
|
|
|
|
|
|
|
| |
Currently the flowopt user allocates the flowopt structure but
cleanup is performed in makesock(). This commit makes the API
symmetric by dropping the cleanup part in makesock() and exporting
flowopt_cleanup(). Now callers have to perform both the allocation
and the cleanup.
The single user (ddcp_recv) is adjusted accordingly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling with -Waggregate-return, gcc issues the following warning:
net.c: In function 'extract_v4_addr':
net.c:682: warning: function returns an aggregate
acl.c: In function 'acl_check_access':
acl.c:60: warning: function call has aggregate value
It's not entirely clear how bad it is these days to return a structure, but
extract_v4_addr() is the only function in the tree which does it. Since it
can be easily changed to take a pointer instead and there is only a single
caller, let's implement it this way.
|
| | |
|
| |
|
|
| |
Better late than never.
|
| |
|
|
|
|
|
| |
These functions end up calling plain write(), hence they work on
arbitrary file descriptors, not just network sockets. So they really
belong to fd.c rather than to net.c. Rename the two functions to
write_buffer() and write_va_buffer().
|
| |
|
|
|
| |
It is just a trivial wrapper for write_all(). This patch changes all
callers to use write_all() directly and removes the wrapper.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
This adds the #include statement for stdbool.h to para.h. This allows
to get rid of the individual includes in *.c.
More importantly, since all *.c files include para.h, booleans will
now be available everywhere so that we won't need to touch dozens of
files anymore whenever a boolean is added to a public structure.
|
| |
|
|
|
|
|
|
|
| |
UNIX_PATH_MAX was hardcoded to 108 for all systems. However, at
least on 32 bit NetBSD the size of the sun_path buffer is only
104 bytes. This resulted in a very nasty bug caused by a memset()
overwriting 4 bytes on the stack.
Fix this by calculating the correct value at compile time.
|
| |
|
|
|
| |
This trivial patch fixes some "discards qualifiers" gcc
warnings when compiling with -Wwrite-strings.
|
| | |
|
| |
|
|
|
|
| |
It's all about local unix domain sockets, so avoid the word
"remote". Also, this function does not create the socket special
in /var/paraslash.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As mandated by RFC 4340, 14., DCCP maintains an internal variable called
'Maximum Packet Size', which can be queried via the DCCP_SOCKOPT_GET_CUR_MPS
socket option. This option has been available since 2007-10-04 (v2.6.23)
and is documented in Documentation/networking/dccp.txt.
The Maximum Packet Size takes into account the path MTU, size of headers and
the estimated overhead for DCCP options. The following table shows various
values that were determined experimentally between two hosts:
+----------+------------+--------------+--------------------+
| Medium | IP version | MTU in bytes | Resulting DCCP MPS |
+----------+------------+--------------+--------------------+
| Ethernet | IPv4 | 1500 | 1424 bytes |
| Ethernet | IPv6 | 1500 | 1404 bytes |
+----------+------------+--------------+--------------------+
| WiFi | IPv4 | 576 | 500 bytes |
| WiFi | IPv4 | 1280 | 1204 bytes |
| WiFi | IPv4 | 1500 | 1424 bytes |
| WiFi (a) | IPv4 | 2048 | 1972 bytes |
+----------+------------+--------------+--------------------+
| WiFi | IPv6 | 576 | see (b) |
| WiFi | IPv6 | 1280 | 1184 bytes |
| WiFi | IPv6 | 1500 | 1404 bytes |
| WiFi (a) | IPv6 | 2048 | 1952 bytes |
+----------+------------+--------------+--------------------+
Notes:
(a) WiFi normally uses Ethernet MTU of 1500 bytes, but the medium
supports a much larger MTU (Fragmentation threshold) of up to
about 2300 bytes (system used 802.11g).
(b) 576 byte MTU not tested for IPv6 since IPv6 mandates a minimum
MTU of 1280 bytes, as per RFC 2460 section 5 (also RFC 5405, 3.2).
The patch implements the dccp init_fec() function based on the DCCP MPS.
|
| |
|
|
|
|
|
| |
This adds a fallback routine to determine the address-family specific maximum
message size (MMS). This value is an over-estimation of the maximum payload
size that the network layer can take, i.e. it returns the maximum size for
transport-layer header and transport-layer payload.
|
| |
|
|
|
|
|
|
|
| |
Make it take an fd_set pointer and check the fd for readability
within para_accept() rather than in each caller. Also, don't return
an error on EAGAIN.
Fix all callers accordingly. Most of them become a bit simpler due
to this change.
|
| |
|
|
|
| |
Move it to fd.c and rename it to read_pattern(). Both users, http_recv.c and http_send.c,
are adjusted accordingly.
|
| |
|
|
| |
Hey, this is earlier than last year :)
|
| |
|
|
|
|
|
|
| |
This fixes a dumb programming error in dccp_available_ccids(), where a
pointer to 1-byte address was type cast to a socklent_t (typically 4 byte)
pointer. Changed the interface to not expose internals of call.
In addition, this patch adds a missing close() in the error path of makesock().
|
| |
|
|
|
|
|
|
| |
There exists at least one system that defines IPPROTO_DCCP but not
DCCP_SOCKOPT_CCID and friends. On such systems compilation fails due
to to undefined symbols.
Fix this problem by checking each value separately.
|
| |
|
|
|
|
|
|
|
|
| |
This is a refactoring of makesock():
* the ubiquitous AF_UNSPEC is promoted as the default;
* a wrapper for active sockets, para_connect_simple();
* para_listen() now supports flowopts;
* a wrapper for passive sockets, para_listen_simple();
* for consistency, port numbers (which are 2 byte in
UDP, TCP, and DCCP) have all been set to 'uint16_t'.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to support a class of socket options which have to be set
before commiting a socket to a connection, this patch adds an API
for "pre-connection" socket options, called "flowopts" here.
The API is used as follows:
* to provide queue storage, a new head is allocated using flowopt_new();
* this queue is then populated with pre-connection socket options via
- generic 'add' method flowopt_add(),
- a specific variant for adding Boolean options - flowopt_add_bool(),
- convenience macros - OPT_ADD(), OPT_ENABLE(), OPT_DISABLE();
* the rest is then dealt with automatically by makesock():
- any provided flowopts are set before making the connection,
- due to using a queue, the order of invocation is preserved,
- after making the connection, makesock() frees storage that has been
previously allocated by flowopt_new() and flowopt_add.*().
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This adds a self-contained function to return the space-separated list of
CCIDs available on the para_server. Visible via 'para_client si'.
Since feature negotiation for CCIDs is supported only from v2.6.30-rc1
(released 7th April 2009), a more recent kernel (>= 2.6.30) is needed to
support this feature, as well as subsequent per-connection use of CCIDs.
Note: This patch still uses a hardcoded upper bound (DCCP_MAX_HOST_CCIDS),
support dynamically detecting the number of CCIDs will be in 2.6.33.
|