소스 검색

[IPv4]: Reply net unreachable ICMP message

IPv4 stack doesn't reply any ICMP destination unreachable message
with net unreachable code when IP detagrams are being discarded
because of no route could be found in the forwarding path.
Incidentally, IPv6 stack replies such ICMPv6 message in the similar
situation.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mitsuru Chinen 17 년 전
부모
커밋
7f53878dc2
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      net/ipv4/route.c

+ 3 - 0
net/ipv4/route.c

@@ -1252,6 +1252,7 @@ static int ip_error(struct sk_buff *skb)
 			break;
 			break;
 		case ENETUNREACH:
 		case ENETUNREACH:
 			code = ICMP_NET_UNREACH;
 			code = ICMP_NET_UNREACH;
+			IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES);
 			break;
 			break;
 		case EACCES:
 		case EACCES:
 			code = ICMP_PKT_FILTERED;
 			code = ICMP_PKT_FILTERED;
@@ -1881,6 +1882,8 @@ no_route:
 	RT_CACHE_STAT_INC(in_no_route);
 	RT_CACHE_STAT_INC(in_no_route);
 	spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
 	spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
 	res.type = RTN_UNREACHABLE;
 	res.type = RTN_UNREACHABLE;
+	if (err == -ESRCH)
+		err = -ENETUNREACH;
 	goto local_input;
 	goto local_input;
 
 
 	/*
 	/*