* make sure RTP ports are chosen to be even

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@725 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-04-16 10:53:27 +00:00
parent e75cc68685
commit 3b803e7168

View file

@ -208,12 +208,15 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail; goto fail;
} }
port = DEFAULT_PORT + (rand() % 512); port = DEFAULT_PORT + ((rand() % 512) << 1);
if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) { if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) {
pa_log(__FILE__": port= expects a numerical argument between 1 and 65535."); pa_log(__FILE__": port= expects a numerical argument between 1 and 65535.");
goto fail; goto fail;
} }
if (port & 1)
pa_log_warn(__FILE__": WARNING: port number not even as suggested in RFC3550!");
dest = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION); dest = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION);
if (inet_pton(AF_INET6, dest, &sa6.sin6_addr) > 0) { if (inet_pton(AF_INET6, dest, &sa6.sin6_addr) > 0) {