New package redir
This patch adds a new package "redir" that allows to redirect incoming TCP connections to a specific destination in a proxy-like way. git-svn-id: svn://svn.openwrt.org/openwrt/packages@15686 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
43
net/redir/patches/02_use_ntohs.patch
Normal file
43
net/redir/patches/02_use_ntohs.patch
Normal file
@ -0,0 +1,43 @@
|
||||
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 */
|
Reference in New Issue
Block a user