7d7d375df9
This patch adds a new package "redir" that allows to redirect incoming TCP connections to a specific destination in a proxy-like way. SVN-Revision: 15686
44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
diff -Nur a/redir.c b/redir.c
|
|
--- a/redir.c 1999-12-26 15:50:06.000000000 -0500
|
|
+++ b/redir.c 2005-10-22 21:29:55.491735272 -0400
|
|
@@ -745,7 +745,7 @@
|
|
}
|
|
|
|
debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
|
|
- debug1("peer socket is %d\n", client.sin_port);
|
|
+ debug1("peer socket is %d\n", ntohs(client.sin_port));
|
|
|
|
/*
|
|
* Double fork here so we don't have to wait later
|
|
@@ -871,8 +871,8 @@
|
|
strcpy(tmp2, inet_ntoa(target->sin_addr));
|
|
|
|
syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
|
|
- tmp1, client.sin_port,
|
|
- tmp2, target->sin_port);
|
|
+ tmp1, ntohs(client.sin_port),
|
|
+ tmp2, ntohs(target->sin_port));
|
|
}
|
|
|
|
/* do proxy stuff */
|
|
@@ -1066,7 +1066,7 @@
|
|
|
|
if (!getpeername(0, (struct sockaddr *) &client, &client_size)) {
|
|
debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
|
|
- debug1("peer socket is %d\n", client.sin_port);
|
|
+ debug1("peer socket is %d\n", ntohs(client.sin_port));
|
|
}
|
|
if ((targetsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
|
perror("target: socket");
|
|
@@ -1109,8 +1109,8 @@
|
|
|
|
if (dosyslog) {
|
|
syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
|
|
- inet_ntoa(client.sin_addr), client.sin_port,
|
|
- target_ip, target.sin_port);
|
|
+ inet_ntoa(client.sin_addr), ntohs(client.sin_port),
|
|
+ target_ip, ntohs(target.sin_port));
|
|
}
|
|
|
|
/* Just start copying - one side of the loop is stdin - 0 */
|