* [patch] ip_dynaddr re-enable
@ 2001-04-16 20:04 Xuan Baldauf
0 siblings, 0 replies; only message in thread
From: Xuan Baldauf @ 2001-04-16 20:04 UTC (permalink / raw)
To: linux-net; +Cc: linux-kernel
[-- 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; */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-03-16 21:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-16 20:04 [patch] ip_dynaddr re-enable Xuan Baldauf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox