Andre Noll [Fri, 4 Apr 2014 12:23:44 +0000 (14:23 +0200)]
audiod: Avoid segfault on exit.
When para_audiod terminates, it calls clean_exit() which closes
all slots unconditionally, regardless of whether they are in use.
This may lead to a segfault due to an invalid read:
==25253== Invalid read of size 4
==25253== at 0x40EBEA: close_slot (audiod.c:443)
==25253== by 0x40FCE8: clean_exit (audiod.c:1163)
==25253== by 0x40FD7D: signal_post_select (audiod.c:1014)
==25253== by 0x41490A: schedule (sched.c:65)
==25253== by 0x406BC3: main (audiod.c:1436)
==25253== Address 0x5c19d8 is not stack'd, malloc'd or (recently) free'd
This bug was introduced 9 month ago in commit eec23a69 (audiod:
Fix memory leak on exit: close slots). Fix it by calling
close_unused_slots(). This also simplifies clean_exit() a bit.
Andre Noll [Sun, 30 Mar 2014 16:31:57 +0000 (18:31 +0200)]
Merge branch 't/misc'
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.
...
Andre Noll [Sun, 23 Mar 2014 18:21:37 +0000 (19:21 +0100)]
Merge branch 't/fade_improvements'
Cooking since 2014-02-08.
* t/fade_improvements:
fade: Improve error diagnostics.
fade: Switch to the fade-in mood *before* sleeping.
fade: Allow to set more than one channel in sleep mode.
fade: Implement new mode "set".
fade: Log to stderr.
Andre Noll [Thu, 27 Feb 2014 18:10:55 +0000 (19:10 +0100)]
Merge branch 't/cmd_improvements'
Cooking since 2014-01-16.
* t/cmd_improvements:
afs.cmd: Strip redundant "sort" from ls help output.
audiod.cmd: Improve grab client help text.
afs.cmd: Improve second level indenting.
afd.cmd: Fix a trivial whitespace issue.
Andre Noll [Wed, 26 Feb 2014 18:16:03 +0000 (19:16 +0100)]
build: Check whether rl_free_keymap is declared.
Readline versions up to and including 6.2 miss to declare the public
symbol rl_free_keymap(). We currently work around this issue by
manually declaring the function in interactive.c.
The recently released readline-6.3, however, does declare that symbol.
Since we compile with -Wredundant-decls this leads to the following
warning:
interactive.c:239:6: warning: redundant redeclaration of 'rl_free_keymap' [-Wredundant-decls]
void rl_free_keymap(Keymap keymap);
This patch gets rid of the warning by adding a check to configure.ac
which detects whether the symbol is declared in the readline header
file. Only if it is uncdelared we declare it manually as before.
Andre Noll [Sat, 22 Feb 2014 16:29:10 +0000 (17:29 +0100)]
Merge branch 't/sync'
Cooking since 2014-01-14.
* t/sync:
The sync filter.
net: Let maksock() callers perform flowopt cleanup.
net: makesock_addrinfo(): Make socketfd local to the loop.
net: Let makesock() continue on setsockopt() failure.
net: Reduce indentation level in makesock_addrinfo().
net: Further simplify makesock_addrinfo().
net: Replace the double loop of lookup_address() by a single loop.
net: makesock(): Combine code for passive sockets.
net: Change makesock_addrinfo() to set given flowopts before SO_REUSEADDR.
net: Clarify code flow of makesock_addrinfo().
net: Remove unnecessary condition in makesock_addrinfo().
net: Remove pointless initialization in makesock_addrinfo().
net: Kill dead code in makesock_addrinfo().
net: Remove networking headers from para.h.
net: Improve error handling of makesock_addrinfo().
net: Split makesock(), part 2: Introduce makesock_addrinfo().
net: Split makesock(), part 1: Introduce lookup_address().
net: Simplify makesock().
net: Fix parse_url().
net: Correct \return text of parse_url().
Andre Noll [Mon, 27 Jan 2014 12:54:49 +0000 (13:54 +0100)]
flac: Try to link also without -logg.
If libflac was compiled without ogg support, the build system should
include flac even if libogg is not installed. Currently this does
not work because the autoconf test tries to link with -logg, so it
always fails if libogg is not available.
Andre Noll [Fri, 3 Jan 2014 05:59:22 +0000 (05:59 +0000)]
Overhaul doxygen main page.
It got way too large, and contained quite a few links to .c files
whose doxygen page is not very interesting. For example, the doxygen
page of the .c files of filters, receivers and writers contain only
the init function since all other functions are static.
This commit limits the number of links on the main page considerably.
The new page tries to focus on important data structures and APIs
and does not strive for completeness.
Andre Noll [Wed, 1 Jan 2014 00:00:34 +0000 (00:00 +0000)]
Change copyright year to 2014.
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
Andre Noll [Sun, 29 Dec 2013 01:45:49 +0000 (01:45 +0000)]
Remove old changelog files.
This simplifies Makefile.real a bit, and of course it's still in the
git history in case somebody is really that interested in the ancient
history of this project.
Andre Noll [Thu, 26 Dec 2013 13:35:08 +0000 (13:35 +0000)]
fade: Improve error diagnostics.
This adds a new generic error code "invalid mixer channel", which is
returned from both ALSA and OSS in case the specified mixer channel
could not be set.
Prior to this patch, ALSA would return a bad channel error also when
the given value was out of range. This is fixed by replacing the now
unused ALSA_MIX_BAD_ELEM error code by the new ALSA_MIX_RANGE code.
Finally, para_fade is changed to no longer print the list of available
channels after it failed to set the initial mode.
Andre Noll [Sun, 6 Oct 2013 09:54:55 +0000 (11:54 +0200)]
fade: Switch to the fade-in mood *before* sleeping.
This way the fade-in mood is active when para_fade is interrupted
during the sleep.
Currently sweet_dreams() calls change_afs_mode_and_play(),
which switches to a different mood and changes the mood directly
thereafter. For the new sematics we need to separate the two
actions though. Hence change_afs_mode_and_play() is renamed to
change_afs_mode(), and it now performs the mood switching part
only. Its two callers are modified to call client_cmd("play")
themselves.
This allows to call change_afs_mode() before we go to sleep and
client_cmd("play") on wake up.
Andre Noll [Wed, 11 Sep 2013 19:48:07 +0000 (19:48 +0000)]
fade: Allow to set more than one channel in sleep mode.
This makes --ivol a string option which may be specified multiple
times, each with its own channel:value pair. The channel part is
optional, invalid channels are ignored.
This change retains backwards-compatibility, i.e. providing a single
value without "channel:" prefix still works as before.
Unfortunately the patch is a bit large since set_channel() had to be
moved to the top of fade.c. This function grew another argument to
specify the channel to set.
Andre Noll [Mon, 2 Dec 2013 21:18:57 +0000 (22:18 +0100)]
Implement aes_ctr128 and prefer it over RC4.
This adds the aes_ctr128 stream cipher to para_server, para_client
and para_audiod. para_server now announces this cipher as a supported
feature and para_client requests an aes_ctr128-encrypted session
if the server supports it. If one or both sides don't understand
the new feature, the RC4 fallback applies. So this change is
backwards-compatible.
Both gcrypt and openssl support aes_ctr128, and the two implementations
are compatible to each other: a para_client linked against openssl can
talk to a para_server which was linked against libgcrypt and vice versa.
This patch also updates the documentation to talk about stream
ciphers and session keys rather than to mention RC4 explicitly. A
short section on AES is added which also explains how counter mode
turns a block cipher into a stream cipher.
Andre Noll [Fri, 20 Dec 2013 22:08:48 +0000 (23:08 +0100)]
afs.cmd: Improve second level indenting.
Currently we have an empty line between each item, mainly to make sure
that man pages including the html version look nice. However, indenting
by spaces and dropping the empty lines looks better in the plaintext
version (help output) while still keeping help2man and man2html happy.
Andre Noll [Sun, 8 Sep 2013 07:31:37 +0000 (07:31 +0000)]
net: Let maksock() callers perform flowopt cleanup.
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.
Andre Noll [Sun, 8 Sep 2013 05:21:22 +0000 (05:21 +0000)]
net: Let makesock() continue on setsockopt() failure.
If the setsockopt() call succeeds but the following bind() fails, we
happily continue to process the address info structure. It seems wrong
to abort the loop if setsockopt() could not enable SO_REUSEADDR. Just
continue in this case.
Andre Noll [Sun, 8 Sep 2013 00:37:29 +0000 (00:37 +0000)]
fade: Implement new mode "set".
While setting the value of a mixer channel has always been possible
using --fade with a zero timeout, this method is somewhat tedious. This
patch introduces the new "set" mode for this purpose.
Andre Noll [Sat, 7 Sep 2013 23:23:14 +0000 (23:23 +0000)]
fade: Log to stderr.
Uunlike all other commands of the paraslash suite, the log function of
para_fade writes to stdout rather than stderr. Make it log to stderr
for the sake of consistency.
Andre Noll [Sat, 7 Sep 2013 00:05:40 +0000 (00:05 +0000)]
net: Split makesock(), part 2: Introduce makesock_addrinfo().
This extracts the addressinfo part of makesock() into the new
makesock_addrinfo(). Hence makesock() becomes a simple function
which first calls lookup_address(), then makesock_addrinfo().
The two helper functions lookup_address() and makesock_addrinfo()
can be made public once there is a need for them.
Andre Noll [Fri, 20 Dec 2013 12:39:49 +0000 (13:39 +0100)]
Merge branch 't/build_system_overhaul'
This topic was quite some PITA to maintain since its commits heavily
conflict with the changes of all other topic branches which touch
the build system. Cooking since 2013-12-01 and tested on FreeBSD,
NetBSD and on different Linux systems.
abb080 Rebuild error2.h on Makefile changes.
71b616 manual: Move crypt library to the list of optional packages.
185c67 build: Don't insist on curses for CLI support.
474d4d build: Rewrite objlist_to_errlist().
1453e8 build: Reorder Makefile.real.
7fb39c build: Split Makefile.in.
d0ddd2 build: Reorder variables in Makefile.in.
61cc38 build: Add Make variable for clock_gettime_ldflags.
976651 build: Add Make variable for PACKAGE_TARNAME.
19b0d3 build: Introduce Make variables for objects.
fe7666 build: Combine link rules.
2440c4 build: Introduce $prefixed_executables.
2f113b build: Combine rules for object files.
761d9b build: Define Make variables for cppflags.
386572 build: Remove two unused variables from Makefile.in.
40439a build: Collect audio format handlers in afh section.
e926e8 build: Move relevant parts to filter section.
b399d6 build: Move relevant parts to gui section.
1781cc build: Move relevant parts to fade section.
0f4790 build: Move relevant parts to audiod section.
4e9788 build: Move relevant parts to client section.
0c8626 build: Move relevant parts to server section.
755904 build: Create section for para_audioc.
d952d6 build: Create section for para_write.
9734df build: Create section for para_play.
14dee3 build: Create section for para_afh.
b1abc2 build: Create section for para_recv.
bfd5b5 build: Create section for para_filter.
9139d9 build: ldflags conversion: coreaudio.
30f966 build: ldflags conversion: libcurses.
15880b build: ldflags conversion: libnsl.
516421 build: ldflags conversion: libsocket.
ce8273 build: ldflags conversion: libgcrypt.
ad3573 build: ldflags conversion: libssl.
52ac85 build: ldflags conversion: libosl.
37083e build: ldflags conversion: libsamplerate.
7de07a build: ldflags conversion: libreadline.
0e9f1c build: ldflags conversion: libao.
ecac89 build: ldflags conversion: alsa.
6c632d build: ldflags conversion: liboss.
e74262 build: ldflags conversion: libflac.
648197 build: ldflags conversion: libmad.
91ed86 build: ldflags conversion: libfaad.
8ee713 build: ldflags/cppflags conversion: libopus.
b6c705 build: cppflags/ldflags conversion: libspeex.
7aa414 build: ldflags conversion: libvorbis.
80a639 build: ldflags conversion: libogg.
c79cdc build: cppflags/ldflags conversion: libid3tag
a02396 build: Remove duplicates from $all_objs.
d2fc4d build: Remove inactive DEBUG_CPPFLAGS.
e8f310 build: Replace error2.pl by error2.c.
06e33e build: Fix filter output of configure summary.
994889 build: Convert remaining object lists to one object per line format.
782e47 build: Separate curses detection from gui configuration.
fbe4b0 build: Move down fade section.
003815 build: Add object "cmdline" suffix only once.
3097e5 INSTALL: Add an example for cross-compiling.
e8b555 build: Fix make install for cross builds.
aab667 build: Generate man pages directly from ggo files.
9a8a15 build: Remove fnmatch, malloc, realloc tests.
2dcdd9 build: Make crypto optional.
f23353 build: Make audiod optional.
98b801 build: Build para_client only if crypto lib was found.
17ed11 build: Create a separate section for para_server.
02c1e0 build: Compute $all_errlist_objs.
4ec04c build: Replace $extras by per-executable variable.
39707e build: Remove two dead recipes from Makefile.in.
9fc99c build: Remove check for buggy snprintf().
Andre Noll [Fri, 20 Dec 2013 10:29:58 +0000 (11:29 +0100)]
Rebuild error2.h on Makefile changes.
Re-running configure without a subsequent make clean currently fails if
the set of objects has changed since the last run. This happens for
example if a different cryptolib was requested with --enable-cryptolib,
or if different libraries were detected by configure.
The problem is that error2.h is not updated according to the new
set of objects. Letting error2.h depend on Makefile should fix it,
because configure creates Makefile, so error2.h will be recreated
after reconfiguring.
Andre Noll [Sun, 17 Nov 2013 22:54:44 +0000 (23:54 +0100)]
udp_recv: Fix clang warning.
clang does not seem to like adding to a string literal:
udp_recv.c:51:45: warning: adding 'size_t' (aka 'unsigned long') to a string does not append to the string [-Wstring-plus-int]
if (memcmp(iov[1].iov_base, FEC_EOF_PACKET + iov[0].iov_len,
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
udp_recv.c:51:45: note: use array indexing to silence this warning
That's kind of silly, but if this simple change makes clang happy,
so be it.
Andre Noll [Sun, 17 Nov 2013 22:52:15 +0000 (23:52 +0100)]
aac_afh: Fix clang warning.
Although gcc seems to have no problem with it, clang complains about
illegal characters in string literals of aac_afh.c:
aac_afh.c:114:25: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
if (!atom_cmp(type1, "<A9>ART"))
^~~~
aac_afh.c:116:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>alb"))
^~~~
aac_afh.c:118:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>nam"))
^~~~
aac_afh.c:120:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>cmt"))
^~~~
aac_afh.c:122:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>day"))
This patch encodes the offending value as "\xa9" to make clang happy,
Andre Noll [Sun, 1 Dec 2013 11:11:46 +0000 (12:11 +0100)]
build: Don't insist on curses for CLI support.
On systems without curses headers/libs, support for interactive
cli tools is deactivated and a message is shown which claims that
readline depends on the curses library. This is not true: readline
uses the termcap functions, but does not link with the termcap or
curses library itself. Applications must choose an appropriate
library that provides these functions.
This change should enable readline support on systems that have
libtermcap but no curses library.