]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IPV4]: Fix "ipOutNoRoutes" counter error for TCP and UDP
authorWei Dong <weidong@cn.fujitsu.com>
Fri, 1 Jun 2007 05:49:28 +0000 (22:49 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 4 Jun 2007 01:08:50 +0000 (18:08 -0700)
Signed-off-by: Wei Dong <weidong@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/datagram.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c

index dd02a45d0f675945c8c85799ac99b4fbea4c9c04..0301dd468cf47638fdd7d434c35ac44a7b96cae6 100644 (file)
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                               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;
index 5a3e7f839fc52f838122a88a40209566ce2e3ab7..47c61055eb601ae73a68b899fdccf5bb8e1921b2 100644 (file)
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                               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);
index 4c7e95fa090d181234e3dbb1a2d1934a259c317f..5da703e699da243afcf6e660d0e6a3df09979981 100644 (file)
@@ -722,8 +722,11 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                                                 .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) &&