Patchwork tcp: fix incorrect LOCKDROPPEDICMPS counter

login
register
mail settings
Submitter Eric Dumazet
Date Jan. 20, 2013, 2:10 a.m.
Message ID <1358647837.3464.1050.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/213898/
State Accepted
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Jan. 20, 2013, 2:10 a.m.
From: Eric Dumazet <edumazet@google.com>

commit 563d34d057 (tcp: dont drop MTU reduction indications)
added an error leading to incorrect accounting of
LINUX_MIB_LOCKDROPPEDICMPS

If socket is owned by the user, we want to increment
this SNMP counter, unless the message is a
(ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED) one.

Reported-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_ipv4.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Maciej Żenczykowski - Jan. 20, 2013, 2:47 a.m.
Signed-off-by: Maciej Żenczykowski <maze@google.com>

On Sat, Jan 19, 2013 at 6:10 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit 563d34d057 (tcp: dont drop MTU reduction indications)
> added an error leading to incorrect accounting of
> LINUX_MIB_LOCKDROPPEDICMPS
>
> If socket is owned by the user, we want to increment
> this SNMP counter, unless the message is a
> (ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED) one.
>
> Reported-by: Maciej Żenczykowski <maze@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> ---
>  net/ipv4/tcp_ipv4.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 54139fa..70b09ef 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -369,11 +369,10 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
>          * We do take care of PMTU discovery (RFC1191) special case :
>          * we can receive locally generated ICMP messages while socket is held.
>          */
> -       if (sock_owned_by_user(sk) &&
> -           type != ICMP_DEST_UNREACH &&
> -           code != ICMP_FRAG_NEEDED)
> -               NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
> -
> +       if (sock_owned_by_user(sk)) {
> +               if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))
> +                       NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
> +       }
>         if (sk->sk_state == TCP_CLOSE)
>                 goto out;
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Neal Cardwell - Jan. 20, 2013, 4:19 a.m.
On Sat, Jan 19, 2013 at 9:10 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit 563d34d057 (tcp: dont drop MTU reduction indications)
> added an error leading to incorrect accounting of
> LINUX_MIB_LOCKDROPPEDICMPS
>
> If socket is owned by the user, we want to increment
> this SNMP counter, unless the message is a
> (ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED) one.
>
> Reported-by: Maciej Żenczykowski <maze@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>

Acked-by: Neal Cardwell <ncardwell@google.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 20, 2013, 10:22 p.m.
From: Neal Cardwell <ncardwell@google.com>
Date: Sat, 19 Jan 2013 23:19:14 -0500

> On Sat, Jan 19, 2013 at 9:10 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> From: Eric Dumazet <edumazet@google.com>
>>
>> commit 563d34d057 (tcp: dont drop MTU reduction indications)
>> added an error leading to incorrect accounting of
>> LINUX_MIB_LOCKDROPPEDICMPS
>>
>> If socket is owned by the user, we want to increment
>> this SNMP counter, unless the message is a
>> (ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED) one.
>>
>> Reported-by: Maciej Żenczykowski <maze@google.com>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> Cc: Neal Cardwell <ncardwell@google.com>
> 
> Acked-by: Neal Cardwell <ncardwell@google.com>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 54139fa..70b09ef 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -369,11 +369,10 @@  void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
 	 * We do take care of PMTU discovery (RFC1191) special case :
 	 * we can receive locally generated ICMP messages while socket is held.
 	 */
-	if (sock_owned_by_user(sk) &&
-	    type != ICMP_DEST_UNREACH &&
-	    code != ICMP_FRAG_NEEDED)
-		NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
-
+	if (sock_owned_by_user(sk)) {
+		if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))
+			NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
+	}
 	if (sk->sk_state == TCP_CLOSE)
 		goto out;