patch-2.1.88 linux/net/ipv4/tcp_ipv4.c
Next file: linux/net/ipv4/udp.c
Previous file: linux/net/ipv4/route.c
Back to the patch index
Back to the overall index
- Lines: 59
- Date:
Thu Feb 19 14:46:16 1998
- Orig file:
v2.1.87/linux/net/ipv4/tcp_ipv4.c
- Orig date:
Thu Feb 12 20:56:14 1998
diff -u --recursive --new-file v2.1.87/linux/net/ipv4/tcp_ipv4.c linux/net/ipv4/tcp_ipv4.c
@@ -42,6 +42,7 @@
* NEW_LISTEN for now)
* Juan Jose Ciarlante: ip_dynaddr bits
* Andi Kleen: various fixes.
+ * Vitaly E. Lavrov : Transparent proxy revived after year coma.
*/
#include <linux/config.h>
@@ -1082,7 +1083,12 @@
memset(th, 0, sizeof(struct tcphdr));
th->syn = 1;
th->ack = 1;
+ th->source =
+#ifdef CONFIG_IP_TRANSPARENT_PROXY
+ req->lcl_port; /* LVE */
+#else
th->source = sk->dummy_th.source;
+#endif
th->dest = req->rmt_port;
skb->seq = req->snt_isn;
skb->end_seq = skb->seq + 1;
@@ -1239,6 +1245,9 @@
req->snd_wscale = tp.snd_wscale;
req->wscale_ok = tp.wscale_ok;
req->rmt_port = th->source;
+#ifdef CONFIG_IP_TRANSPARENT_PROXY
+ req->lcl_port = th->dest ; /* LVE */
+#endif
req->af.v4_req.loc_addr = daddr;
req->af.v4_req.rmt_addr = saddr;
@@ -1361,7 +1370,12 @@
tcp_init_xmit_timers(newsk);
- newsk->dummy_th.source = sk->dummy_th.source;
+ newsk->dummy_th.source =
+#ifdef CONFIG_IP_TRANSPARENT_PROXY
+ req->lcl_port; /* LVE */
+#else
+ sk->dummy_th.source;
+#endif
newsk->dummy_th.dest = req->rmt_port;
newsk->sock_readers=0;
@@ -1371,6 +1385,13 @@
newsk->socket = NULL;
+#ifdef CONFIG_IP_TRANSPARENT_PROXY
+ /*
+ * Deal with possibly redirected traffic by setting num to
+ * the intended destination port of the received packet.
+ */
+ newsk->num = ntohs(skb->h.th->dest);
+#endif
newsk->daddr = req->af.v4_req.rmt_addr;
newsk->saddr = req->af.v4_req.loc_addr;
newsk->rcv_saddr = req->af.v4_req.loc_addr;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov