Created
December 31, 2015 21:01
-
-
Save ianblenke/bcec0aa591369c9b3b82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u rtpproxy-1.2.1/main.c rtpproxy-1.2.1-adv2/main.c | |
--- rtpproxy-1.2.1/main.c 2012-10-04 22:09:35.000000000 +0200 | |
+++ rtpproxy-1.2.1-adv2/main.c 2013-07-18 10:54:02.000000000 +0200 | |
@@ -98,7 +98,8 @@ | |
fprintf(stderr, "usage: rtpproxy [-2fvFiPa] [-l addr1[/addr2]] " | |
"[-6 addr1[/addr2]] [-s path]\n\t[-t tos] [-r rdir [-S sdir]] [-T ttl] " | |
"[-L nfiles] [-m port_min]\n\t[-M port_max] [-u uname[:gname]] " | |
- "[-n timeout_socket] [-d log_level[:log_facility]]\n"); | |
+ "[-n timeout_socket] [-d log_level[:log_facility]] " | |
+ "[-A addr1[/addr2]]\n"); | |
exit(1); | |
} | |
@@ -133,6 +134,9 @@ | |
cf->port_min = PORT_MIN; | |
cf->port_max = PORT_MAX; | |
+ cf->advaddr[0] = NULL; | |
+ cf->advaddr[1] = NULL; | |
+ | |
cf->max_ttl = SESSION_TIMEOUT; | |
cf->tos = TOS; | |
cf->rrtcp = 1; | |
@@ -147,7 +151,7 @@ | |
if (getrlimit(RLIMIT_NOFILE, &(cf->nofile_limit)) != 0) | |
err(1, "getrlimit"); | |
- while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:T:L:m:M:u:Fin:Pad:")) != -1) | |
+ while ((ch = getopt(argc, argv, "vf2Rl:6:s:S:t:r:p:T:L:m:M:u:Fin:Pad:A:")) != -1) | |
switch (ch) { | |
case 'f': | |
cf->nodaemon = 1; | |
@@ -173,6 +177,23 @@ | |
} | |
break; | |
+ case 'A': | |
+ cf->advaddr[0] = optarg; | |
+ cf->advaddr[1] = strchr(cf->advaddr[0], '/'); | |
+ if (cf->advaddr[1] != NULL) { | |
+ *cf->advaddr[1] = '\0'; | |
+ cf->advaddr[1]++; | |
+ if(*cf->advaddr[0]==0) { | |
+ errx(1, "first advertised address is invalid"); | |
+ exit(0); | |
+ } | |
+ if(*cf->advaddr[1]==0) { | |
+ errx(1, "second advertised address is invalid"); | |
+ exit(0); | |
+ } | |
+ } | |
+ break; | |
+ | |
case 's': | |
if (strncmp("udp:", optarg, 4) == 0) { | |
cf->umode = 1; | |
Common subdirectories: rtpproxy-1.2.1/rpm and rtpproxy-1.2.1-adv2/rpm | |
diff -u rtpproxy-1.2.1/rtpp_command.c rtpproxy-1.2.1-adv2/rtpp_command.c | |
--- rtpproxy-1.2.1/rtpp_command.c 2012-10-04 22:09:35.000000000 +0200 | |
+++ rtpproxy-1.2.1-adv2/rtpp_command.c 2013-07-18 10:47:35.000000000 +0200 | |
@@ -201,9 +201,21 @@ | |
} | |
if (lia[0] == NULL || ishostnull(lia[0])) | |
len += sprintf(cp, "%d\n", lport); | |
- else | |
- len += sprintf(cp, "%d %s%s\n", lport, addr2char(lia[0]), | |
- (lia[0]->sa_family == AF_INET) ? "" : " 6"); | |
+ else { | |
+ if(cf->advaddr[0] != NULL) { | |
+ if(cf->bmode!=0 && cf->advaddr[1]!=NULL | |
+ && lia[0]==cf->bindaddr[1]) { | |
+ len += sprintf(cp, "%d %s%s\n", lport, cf->advaddr[1], | |
+ (lia[0]->sa_family == AF_INET) ? "" : " 6"); | |
+ } else { | |
+ len += sprintf(cp, "%d %s%s\n", lport, cf->advaddr[0], | |
+ (lia[0]->sa_family == AF_INET) ? "" : " 6"); | |
+ } | |
+ } else { | |
+ len += sprintf(cp, "%d %s%s\n", lport, addr2char(lia[0]), | |
+ (lia[0]->sa_family == AF_INET) ? "" : " 6"); | |
+ } | |
+ } | |
doreply(cf, fd, buf, len, raddr, rlen); | |
} | |
diff -u rtpproxy-1.2.1/rtpp_defines.h rtpproxy-1.2.1-adv2/rtpp_defines.h | |
--- rtpproxy-1.2.1/rtpp_defines.h 2012-10-04 22:09:35.000000000 +0200 | |
+++ rtpproxy-1.2.1-adv2/rtpp_defines.h 2013-07-18 10:36:32.000000000 +0200 | |
@@ -103,6 +103,7 @@ | |
* mode enabled. | |
*/ | |
struct sockaddr *bindaddr[2]; /* RTP socket(s) addresses */ | |
+ char *advaddr[2]; /* advertised addresses */ | |
int tos; | |
const char *rdir; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment