aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/ip_input.c6
-rw-r--r--net/ipv4/route.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index af2ec88bbb2f..c703528e0bcd 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -283,14 +283,18 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
283{ 283{
284 struct net_device *dev = skb->dev; 284 struct net_device *dev = skb->dev;
285 struct iphdr *iph = skb->nh.iph; 285 struct iphdr *iph = skb->nh.iph;
286 int err;
286 287
287 /* 288 /*
288 * Initialise the virtual path cache for the packet. It describes 289 * Initialise the virtual path cache for the packet. It describes
289 * how the packet travels inside Linux networking. 290 * how the packet travels inside Linux networking.
290 */ 291 */
291 if (skb->dst == NULL) { 292 if (skb->dst == NULL) {
292 if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev)) 293 if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
294 if (err == -EHOSTUNREACH)
295 IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
293 goto drop; 296 goto drop;
297 }
294 } 298 }
295 299
296#ifdef CONFIG_NET_CLS_ROUTE 300#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 80cf633d9f4a..12a1cf306f67 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1909,7 +1909,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
1909 */ 1909 */
1910 if ((err = fib_lookup(&fl, &res)) != 0) { 1910 if ((err = fib_lookup(&fl, &res)) != 0) {
1911 if (!IN_DEV_FORWARD(in_dev)) 1911 if (!IN_DEV_FORWARD(in_dev))
1912 goto e_inval; 1912 goto e_hostunreach;
1913 goto no_route; 1913 goto no_route;
1914 } 1914 }
1915 free_res = 1; 1915 free_res = 1;
@@ -1933,7 +1933,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
1933 } 1933 }
1934 1934
1935 if (!IN_DEV_FORWARD(in_dev)) 1935 if (!IN_DEV_FORWARD(in_dev))
1936 goto e_inval; 1936 goto e_hostunreach;
1937 if (res.type != RTN_UNICAST) 1937 if (res.type != RTN_UNICAST)
1938 goto martian_destination; 1938 goto martian_destination;
1939 1939
@@ -2025,6 +2025,11 @@ martian_destination:
2025 "%u.%u.%u.%u, dev %s\n", 2025 "%u.%u.%u.%u, dev %s\n",
2026 NIPQUAD(daddr), NIPQUAD(saddr), dev->name); 2026 NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
2027#endif 2027#endif
2028
2029e_hostunreach:
2030 err = -EHOSTUNREACH;
2031 goto done;
2032
2028e_inval: 2033e_inval:
2029 err = -EINVAL; 2034 err = -EINVAL;
2030 goto done; 2035 goto done;