Fix "ipOutNoRoutes" counter error for TCP and UDP
Subsystems (4)
Hi Mr. David
I have modified my patch according to you advice. I think -
EHOSTUNREACH is only for "input path". In "output" path, we can just simply check-ENETUNREACH (^_^), the patch is shown in the end of this mail.
I send this patch to you several weeks ago, but you have not replied to me.
This patch is not correctly?
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Function need to fix:
tcp_v4_connect();ip4_datagram_connect();udp_sendmsg();I think we need to make these checks more carefully.
Route lookup can fail for several reasons other than no route being available. Two examples are:
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
1) Out of memory error while creating route
2) IPSEC disallows communication to that flow IDAs a result, we'll probably best limiting the counter increment when the error is either
-EHOSTUNREACHor-ENETUNREACH.
net/ipv4/datagram.c 2007-04-25 15:21:42.000000000 +0800 renamed from net/ipv4/datagram.c 2007-04-25 15:20:19.000000000 +0800 +5 -1
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk RT_CONN_FLAGS(sk), oif, sk->sk_protocol, inet->sport, usin->sin_port, sk); - if (err) + if (err) { + if (err == -ENETUNREACH) + IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); return err; + } + if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { ip_rt_put(rt); return -EACCES;
net/ipv4/tcp_ipv4.c 2007-04-25 15:21:42.000000000 +0800 renamed from net/ipv4/tcp_ipv4.c 2007-04-25 15:20:19.000000000 +0800 +4 -1
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, stru RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, IPPROTO_TCP, inet->sport, usin->sin_port, sk); - if (tmp < 0) + if (tmp < 0) { + if (tmp == -ENETUNREACH) + IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); return tmp; + } if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { ip_rt_put(rt);
net/ipv4/udp.c 2007-04-25 15:21:42.000000000 +0800 renamed from net/ipv4/udp.c 2007-04-25 15:20:19.000000000 +0800 +0 -0
@@ -630,8 +630,11 @@ int udp_sendmsg(struct kiocb *iocb, stru .dport = dport } } }; security_sk_classify_flow(sk, &fl); err = ip_route_output_flow(&rt, &fl, sk,
!(msg->msg_flags&MSG_DONTWAIT));
- if (err)
+ if (err) {
+ if (err == -ENETUNREACH)
+ IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
goto out;+ }
err = -EACCES;
if ((rt->rt_flags & RTCF_BROADCAST) &&David Miller
maintainerPlease stop sending your patche emails twice every time.
I got the first copy!
Thank you :-)
David Miller
maintainerFrom: Wei Dong <[email protected]>
Date: Thu, 31 May 2007 09:16:50 +0800
Quoted 7 lines
Hi Mr. David
I have modified my patch according to you advice. I think -
EHOSTUNREACH is only for "input path". In "output" path, we can just simply check-ENETUNREACH (^_^), the patch is shown in the end of this mail.I send this patch to you several weeks ago, but you have not replied to me.
This patch is not correctly?
Your email client is still corrupting the patch, it changes tab characters into spaces. This makes the patch not apply.
Please do not send the same unusable patch so many times. Instead, I recommend to email the patch to yourself, and you try to apply it, in the same way someone else receiving your patch posting would.
Mr David
Sorry to trouble many times, I will attention to this next time.
I have made this patch again, and I tried, it can be patched to the recently kernel of linux-2.6.21.3. following is the patch, and I also attach this patch to the attachment.
net/ipv4/datagram.c 2007-06-01 13:24:21.000000000 +0800 renamed from net/ipv4/datagram.c 2007-06-01 13:22:39.000000000 +0800 +5 -1
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk RT_CONN_FLAGS(sk), oif, sk->sk_protocol, inet->sport, usin->sin_port, sk, 1); - if (err) + if (err) { + if (err == -ENETUNREACH) + IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); return err; + } + if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { ip_rt_put(rt); return -EACCES;
net/ipv4/tcp_ipv4.c 2007-06-01 13:25:07.000000000 +0800 renamed from net/ipv4/tcp_ipv4.c 2007-06-01 13:22:39.000000000 +0800 +4 -1
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, stru RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, IPPROTO_TCP, inet->sport, usin->sin_port, sk, 1); - if (tmp < 0) + if (tmp < 0) { + if (tmp == -ENETUNREACH) + IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); return tmp; + } if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { ip_rt_put(rt);
net/ipv4/udp.c 2007-06-01 13:26:47.000000000 +0800 renamed from net/ipv4/udp.c 2007-06-01 13:22:39.000000000 +0800 +4 -1
@@ -631,8 +631,11 @@ int udp_sendmsg(struct kiocb *iocb, stru .dport = dport } } }; security_sk_classify_flow(sk, &fl); err = ip_route_output_flow(&rt, &fl, sk, 1); - if (err) + if (err) { + if (err == -ENETUNREACH) + IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); goto out; + } err = -EACCES; if ((rt->rt_flags & RTCF_BROADCAST) &&
Quoted 19 lines · David Miller
From: Wei Dong <[email protected]>
Date: Thu, 31 May 2007 09:16:50 +0800Quoted 7 lines
Hi Mr. David
I have modified my patch according to you advice. I think -
EHOSTUNREACH is only for "input path". In "output" path, we can just simply check-ENETUNREACH (^_^), the patch is shown in the end of this mail.I send this patch to you several weeks ago, but you have not replied to me.
This patch is not correctly?Your email client is still corrupting the patch, it changes tab characters into spaces. This makes the patch not apply.
Please do not send the same unusable patch so many times. Instead, I recommend to email the patch to yourself, and you try to apply it, in the same way someone else receiving your patch posting would.
Quoted 6 lines
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
net/ipv4/datagram.c +5 -1
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *skRT_CONN_FLAGS (sk), oif, sk->sk_protocol, inet->sport, usin->sin_port, sk, 1); -if (err) +if (err) { +if (err == -ENETUNREACH ) +IP_INC_STATS_BH (IPSTATS_MIB_OUTNOROUTES );return err; + } +if ((rt->rt_flags &RTCF_BROADCAST ) && !sock_flag (sk,SOCK_BROADCAST )) {ip_rt_put (rt);return -EACCES ;
net/ipv4/tcp_ipv4.c +4 -1
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, struRT_CONN_FLAGS (sk), sk->sk_bound_dev_if,IPPROTO_TCP , inet->sport, usin->sin_port, sk, 1); -if (tmp <0 ) +if (tmp <0 ) { +if (tmp == -ENETUNREACH ) +IP_INC_STATS_BH (IPSTATS_MIB_OUTNOROUTES );return tmp; + }if (rt->rt_flags & (RTCF_MULTICAST |RTCF_BROADCAST )) {ip_rt_put (rt);
net/ipv4/udp.c +4 -1
@@ -631,8 +631,11 @@ int udp_sendmsg(struct kiocb *iocb, stru .dport = dport } } };security_sk_classify_flow (sk, &fl); err =ip_route_output_flow (&rt, &fl, sk,1 ); -if (err) +if (err) { +if (err == -ENETUNREACH ) +IP_INC_STATS_BH (IPSTATS_MIB_OUTNOROUTES ); goto out; + } err = -EACCES ; if ((rt->rt_flags & RTCF_BROADCAST) &&
David Miller
maintainerFrom: weidong <[email protected]>
Date: Fri, 01 Jun 2007 13:37:08 +0800
Quoted 9 lines
Mr David
Sorry to trouble many times, I will attention to this next time.
I have made this patch again, and I tried, it can be patched to the recently kernel of linux-2.6.21.3. following is the patch, and I also attach this patch to the attachment.
Signed-off-by Wei Dong <[email protected]>
Patch applied, thank you.