public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xuan Baldauf <xuan--lkml@baldauf.org>
To: linux-net@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch] ip_dynaddr re-enable
Date: Mon, 16 Apr 2001 22:04:27 +0200	[thread overview]
Message-ID: <3ADB504B.691393B0@baldauf.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

Hello,

about one or two months ago, I had the problem that
/proc/sys/net/ipv4/ip_dynaddr did not work. I analyzed the
problem and somehow came to a solution which I have
forgotten. But a patch which solved the problem against
2.4.1 which also works for 2.4.2-pre4 remained. Here it is.

Xuân.



[-- Attachment #2: linux-2.4.ip_dynaddr.reenable.patch --]
[-- Type: text/plain, Size: 1361 bytes --]

--- linux/net/ipv4/tcp_ipv4.c.orig	Tue Jan 30 11:37:56 2001
+++ linux/net/ipv4/tcp_ipv4.c	Tue Jan 30 13:31:14 2001
@@ -1774,6 +1774,11 @@
 	u32 daddr;
 	int err;
 
+	if (sysctl_ip_dynaddr > 2) {
+		printk(KERN_INFO "tcp_v4_rebuild_header(): sysctl_ip_dynaddr=%d, sk->userlocks=0x%x, rt==0x%x, src=%d.%d.%d.%d, sk->state=%d,sk->userlocks=0x%x.\n",
+		       sysctl_ip_dynaddr, sk->userlocks,rt,NIPQUAD(sk->saddr),sk->state,sk->userlocks);
+	}
+
 	/* Route is OK, nothing to do. */
 	if (rt != NULL)
 		return 0;
@@ -1783,9 +1788,26 @@
 	if(sk->protinfo.af_inet.opt && sk->protinfo.af_inet.opt->srr)
 		daddr = sk->protinfo.af_inet.opt->faddr;
 
+	if ((sysctl_ip_dynaddr) && (sk->state == TCP_SYN_SENT) && (!(sk->userlocks & SOCK_BINDADDR_LOCK)) ) {
+	    err = tcp_v4_reselect_saddr(sk);
+
+		if (sysctl_ip_dynaddr > 2) {
+			printk(KERN_INFO "tcp_v4_rebuild_header(): tcp_v4_reselect_saddr(sk)=%d.\n",err);
+		}
+	    
+	    if (err!=0) {
+		sk->err_soft=-err;
+		/* sk->error_report(sk); */
+	    }
+	}
+
 	err = ip_route_output(&rt, daddr, sk->saddr,
 			      RT_TOS(sk->protinfo.af_inet.tos) | RTO_CONN | sk->localroute,
 			      sk->bound_dev_if);
+	if (sysctl_ip_dynaddr > 2) {
+		printk(KERN_INFO "tcp_v4_rebuild_header(): err=%d.\n",
+		       err);
+	}
 	if (!err) {
 		__sk_dst_set(sk, &rt->u.dst);
 		/* sk->route_caps = rt->u.dst.dev->features; */

                 reply	other threads:[~2001-03-16 21:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ADB504B.691393B0@baldauf.org \
    --to=xuan--lkml@baldauf.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox