diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/datagram.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 5 | ||||
-rw-r--r-- | net/ipv4/udp.c | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index dd02a45d0f67..0301dd468cf4 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
50 | RT_CONN_FLAGS(sk), oif, | 50 | RT_CONN_FLAGS(sk), oif, |
51 | sk->sk_protocol, | 51 | sk->sk_protocol, |
52 | inet->sport, usin->sin_port, sk, 1); | 52 | inet->sport, usin->sin_port, sk, 1); |
53 | if (err) | 53 | if (err) { |
54 | if (err == -ENETUNREACH) | ||
55 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | ||
54 | return err; | 56 | return err; |
57 | } | ||
58 | |||
55 | if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { | 59 | if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { |
56 | ip_rt_put(rt); | 60 | ip_rt_put(rt); |
57 | return -EACCES; | 61 | return -EACCES; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 5a3e7f839fc5..47c61055eb60 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
192 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, | 192 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, |
193 | IPPROTO_TCP, | 193 | IPPROTO_TCP, |
194 | inet->sport, usin->sin_port, sk, 1); | 194 | inet->sport, usin->sin_port, sk, 1); |
195 | if (tmp < 0) | 195 | if (tmp < 0) { |
196 | if (tmp == -ENETUNREACH) | ||
197 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | ||
196 | return tmp; | 198 | return tmp; |
199 | } | ||
197 | 200 | ||
198 | if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { | 201 | if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { |
199 | ip_rt_put(rt); | 202 | ip_rt_put(rt); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4c7e95fa090d..5da703e699da 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -722,8 +722,11 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
722 | .dport = dport } } }; | 722 | .dport = dport } } }; |
723 | security_sk_classify_flow(sk, &fl); | 723 | security_sk_classify_flow(sk, &fl); |
724 | err = ip_route_output_flow(&rt, &fl, sk, 1); | 724 | err = ip_route_output_flow(&rt, &fl, sk, 1); |
725 | if (err) | 725 | if (err) { |
726 | if (err == -ENETUNREACH) | ||
727 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | ||
726 | goto out; | 728 | goto out; |
729 | } | ||
727 | 730 | ||
728 | err = -EACCES; | 731 | err = -EACCES; |
729 | if ((rt->rt_flags & RTCF_BROADCAST) && | 732 | if ((rt->rt_flags & RTCF_BROADCAST) && |