All of lore.kernel.org
 help / color / mirror / Atom feed
From: weidong <weidong@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: Fix "ipOutNoRoutes" counter error for TCP and UDP
Date: Fri, 01 Jun 2007 13:37:08 +0800	[thread overview]
Message-ID: <465FB084.70609@cn.fujitsu.com> (raw)
In-Reply-To: <20070531.214104.31597841.davem@davemloft.net>

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

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 <weidong@cn.fujitsu.com>

diff -Nurp a/net/ipv4/datagram.c b/net/ipv4/datagram.c
--- a/net/ipv4/datagram.c       2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/datagram.c       2007-06-01 13:24:21.000000000 +0800
@@ -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;
diff -Nurp a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c       2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/tcp_ipv4.c       2007-06-01 13:25:07.000000000 +0800
@@ -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);
diff -Nurp a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c    2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/udp.c    2007-06-01 13:26:47.000000000 +0800
@@ -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 wrote:
> From: Wei Dong <weidong@cn.fujitsu.com>
> Date: Thu, 31 May 2007 09:16:50 +0800
> 
>> 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.
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

[-- Attachment #2: ipOutNoRoutes.patch --]
[-- Type: text/x-patch, Size: 1670 bytes --]

diff -Nurp a/net/ipv4/datagram.c b/net/ipv4/datagram.c
--- a/net/ipv4/datagram.c	2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/datagram.c	2007-06-01 13:24:21.000000000 +0800
@@ -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;
diff -Nurp a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c	2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/tcp_ipv4.c	2007-06-01 13:25:07.000000000 +0800
@@ -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);
diff -Nurp a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c	2007-06-01 13:22:39.000000000 +0800
+++ b/net/ipv4/udp.c	2007-06-01 13:26:47.000000000 +0800
@@ -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) &&

  reply	other threads:[~2007-06-01  5:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31  1:16 Fix "ipOutNoRoutes" counter error for TCP and UDP Wei Dong
2007-05-31  1:38 ` David Miller
2007-06-01  4:41 ` David Miller
2007-06-01  5:37   ` weidong [this message]
2007-06-01  5:49     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2007-05-31  1:18 Wei Dong
2007-04-25  9:04 weidong
     [not found] <462F029D.5070301@cn.fujitsu.com>
2007-04-25  8:27 ` David Miller
2007-04-25  7:39 weidong
2007-03-28  1:15 weidong
2007-03-27 10:53 Wei Dong
2007-02-14 15:03 weidong
2007-02-27  1:08 ` David Miller

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=465FB084.70609@cn.fujitsu.com \
    --to=weidong@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.