From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Krishna Kumar2 <krkumar2@in.ibm.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 2.4.35.3] Fix the "InAddrErrors" increasing problem
Date: Mon, 22 Oct 2007 15:10:46 +0800 [thread overview]
Message-ID: <471C4CF6.1000206@cn.fujitsu.com> (raw)
In-Reply-To: <OF2D84A661.11AB43B8-ON6525737C.002349E6-6525737C.00238C77@in.ibm.com>
Krishna Kumar2 写道:
> Gui Jianfeng wrote on 10/22/2007 11:37:07 AM:
>
>> @@ -310,8 +310,12 @@ static inline int ip_rcv_finish(struct s
>> * how the packet travels inside Linux networking.
>> */
>> if (skb->dst == NULL) {
>> - if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))
>> - goto drop;
>> + int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
> dev);
>> + if (unlikely(err)) {
>> + if (err == -EHOSTUNREACH)
>> + IP_INC_STATS_BH(IpInAddrErrors);
>> + }
>> + goto drop;
>> }
>
> Shouldn't the "goto drop" be inside the "if (unlikely(err)) {" case?
> And normally it is nice to have a blank line after variable declaration.
sorry for my careless, here is the correct one
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
-------
diff -Narup linux-2.4.35.3/net/ipv4/ip_input.c linux-2.4.35.3-prep/net/ipv4/ip_input.c
--- linux-2.4.35.3/net/ipv4/ip_input.c 2007-09-24 06:02:58.000000000 +0800
+++ linux-2.4.35.3-prep/net/ipv4/ip_input.c 2007-09-26 11:30:22.000000000 +0800
@@ -310,8 +310,13 @@ static inline int ip_rcv_finish(struct s
* how the packet travels inside Linux networking.
*/
if (skb->dst == NULL) {
- if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))
+ int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev);
+
+ if (unlikely(err)) {
+ if (err == -EHOSTUNREACH)
+ IP_INC_STATS_BH(IpInAddrErrors);
goto drop;
+ }
}
#ifdef CONFIG_NET_CLS_ROUTE
diff -Narup linux-2.4.35.3/net/ipv4/route.c linux-2.4.35.3-prep/net/ipv4/route.c
--- linux-2.4.35.3/net/ipv4/route.c 2007-09-24 06:02:58.000000000 +0800
+++ linux-2.4.35.3-prep/net/ipv4/route.c 2007-09-26 11:29:19.000000000 +0800
@@ -1450,7 +1450,7 @@ int ip_route_input_slow(struct sk_buff *
*/
if ((err = fib_lookup(&key, &res)) != 0) {
if (!IN_DEV_FORWARD(in_dev))
- goto e_inval;
+ goto e_hostunreach;
goto no_route;
}
free_res = 1;
@@ -1499,7 +1499,7 @@ int ip_route_input_slow(struct sk_buff *
}
if (!IN_DEV_FORWARD(in_dev))
- goto e_inval;
+ goto e_hostunreach;
if (res.type != RTN_UNICAST)
goto martian_destination;
@@ -1668,6 +1668,11 @@ martian_destination:
"%u.%u.%u.%u, dev %s\n",
NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
#endif
+
+e_hostunreach:
+ err = -EHOSTUNREACH;
+ goto done;
+
e_inval:
err = -EINVAL;
goto done;
>
> - KK
>
>
>
next prev parent reply other threads:[~2007-10-22 7:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 6:07 [PATCH 2.4.35.3] Fix the "InAddrErrors" increasing problem Gui Jianfeng
2007-10-22 6:16 ` David Miller
2007-10-22 6:28 ` Krishna Kumar2
2007-10-22 6:45 ` Gui Jianfeng
2007-10-22 7:10 ` Gui Jianfeng [this message]
2007-10-22 7:23 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=471C4CF6.1000206@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
--cc=davem@davemloft.net \
--cc=krkumar2@in.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).