Patches item #1575919, was opened at 2006-10-12 06:28 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1575919&group_id=139143
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: tools Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Port range configurable with CLI Initial Comment: Hi, I am not sure where RTPProxy is developped right now. SER developpers' site at berlios.de looks idle, therefore I dare to submit it here in order to prevent losing it. Please, feel free to drop it and point me out the correct place to submit this patch. My email address is: jeremie @t le-hen d0t org (sorry for obfuscation). This patch adds the -P option which permits to configure the port range used by RTPProxy from command-line. -- Jérémie LE HEN ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2007-04-20 10:13 Message: Logged In: NO The patch is incomplete since number of structures are allocated statically based on difference between PORT_MIN and PORT_MAX, so that potentially with configurable range it's possible to overflow those compile-time limits. -Maxim ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2006-10-13 07:57 Message: Logged In: NO Sorry, the previous patch had a dumb bug (use of || instead of &&)... diff -urp rtpproxy.orig/main.c rtpproxy/main.c --- rtpproxy.orig/main.c Wed Jul 5 02:14:19 2006 +++ rtpproxy/main.c Fri Sep 29 11:57:32 2006 @@ -48,6 +48,7 @@ #include <poll.h> #include <sched.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <signal.h> #include <string.h> @@ -101,6 +102,8 @@ static struct sockaddr *bindaddr[2]; /* static rtpp_log_t glog; static int tos = TOS; +static int port_min = PORT_MIN; +static int port_max = PORT_MAX; static int lastport[2] = {PORT_MIN - 1, PORT_MIN - 1}; static const char *rdir = NULL; static const char *sdir = NULL; @@ -755,7 +758,7 @@ handle_command(int controlfd) if (spa->fds[i] == -1) { j = ishostseq(bindaddr[0], spa->laddr[i]) ? 0 : 1; - if (create_listener(spa->laddr[i], PORT_MIN, PORT_MAX, + if (create_listener(spa->laddr[i], port_min, port_max, lastport[j], &lport, fds) == -1) { rtpp_log_write(RTPP_LOG_ERR, spa->log, "can't create listener"); ecode = 7; @@ -826,7 +829,7 @@ handle_command(int controlfd) call_id, from_tag, weak ? "weak" : "strong"); j = ishostseq(bindaddr[0], lia[0]) ? 0 : 1; - if (create_listener(bindaddr[j], PORT_MIN, PORT_MAX, + if (create_listener(bindaddr[j], port_min, port_max, lastport[j], &lport, fds) == -1) { rtpp_log_write(RTPP_LOG_ERR, glog, "can't create listener"); ecode = 10; @@ -1026,7 +1029,7 @@ main(int argc, char **argv) dmode = 0; - while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:T:L:")) != -1) + while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:P:T:L:")) != -1) switch (ch) { case 'f': nodaemon = 1; @@ -1097,6 +1100,26 @@ main(int argc, char **argv) case 'p': pid_file = optarg; + break; + + case 'P': + errno = 0; + port_min = (int)strtoul(optarg, &cp, 10); + if (errno != 0) + err(1, "%s", optarg); + if (*cp != ':' && *cp != '-') + errx(1, "%s: Bad separator in port range", optarg); + cp++; + port_max = (int)strtoul(cp, &cp, 10); + if (errno != 0) + err(1, "%s", optarg); + if (*cp != '\0') + errx(1, "%s: Bad port range", optarg); + if (port_max - port_min < 4) + errx(1, "%s: Port range too small", optarg); + if (port_min < 1 || port_max > 65535) + errx(1, "%s: Invalid ports", optarg); + lastport[0] = lastport[1] = port_min - 1; break; case 'T': ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1575919&group_id=139143 _______________________________________________ Devel mailing list Devel@openser.org http://openser.org/cgi-bin/mailman/listinfo/devel