From 555c0c738be4441867f1f5f1c0e4983bc553af35 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 16 Apr 2017 17:09:59 +0100 Subject: [PATCH] Fix off-by-one error in enumatering UDP ports in the port_range. Make the error message a little more useful. --- rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtp.c b/rtp.c index 921da780..af98b349 100644 --- a/rtp.c +++ b/rtp.c @@ -562,13 +562,13 @@ static int bind_port(int ip_family, const char *self_ip_address, uint32_t scope_ #endif } while ((ret < 0) && (errno == EADDRINUSE) && (desired_port != 0) && - (desired_port++ < config.udp_port_base + config.udp_port_range)); + (++desired_port < config.udp_port_base + config.udp_port_range)); // debug(1,"UDP port chosen: %d.",desired_port); if (ret < 0) { close(local_socket); - die("error: could not bind a UDP port!"); + die("error: could not bind a UDP port! Check the udp_port_range is large enough (>= 10) or check for restrictive firewall settings or a bad router!"); } int sport;