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) &&