Commit faac387c authored by StefanBruens's avatar StefanBruens Committed by Tanu Kaskinen
Browse files

raop: Send initial timing packet to prime UDP connection tracking

In case the local UDP port is blocked by a firewall by default, send
an initial timing packet so the connection tracking will accept the
response packages.

Otherwise, the connection will fail with an 'RTSP/1.0 500 Internal
Server Error' after some timeout.

Fixes: pulseaudio/pulseaudio#840
parent 58482aa9
......@@ -681,6 +681,18 @@ static size_t handle_udp_timing_packet(pa_raop_client *c, const uint8_t packet[]
return written;
static void send_initial_udp_timing_packet(pa_raop_client *c) {
uint32_t data[6] = { 0 };
struct timeval tv;
uint64_t initial_time = 0;
initial_time = timeval_to_ntp(pa_rtclock_get(&tv));
data[4] = htonl(initial_time >> 32);
data[5] = htonl(initial_time & 0xffffffff);
send_udp_timing_packet(c, data, initial_time);
static int connect_udp_socket(pa_raop_client *c, int fd, uint16_t port) {
struct sockaddr_in sa4;
#ifdef HAVE_IPV6
......@@ -1077,6 +1089,13 @@ connect_finish:
pa_log_debug("Connection established (UDP;control_port=%d;timing_port=%d)", cport, tport);
/* Send an initial UDP packet so a connection tracking firewall
* knows the src_ip:src_port <-> dest_ip:dest_port relation
* and accepts the incoming timing packets.
pa_log_debug("Sent initial timing packet to UDP port %d", tport);
if (c->state_callback)
c->state_callback(PA_RAOP_CONNECTED, c->state_userdata);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment