lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUwQDxibc1lw9mrG@shredder>
Date: Wed, 24 Dec 2025 18:08:47 +0200
From: Ido Schimmel <idosch@...sch.org>
To: yuan.gao@...oud.cn
Cc: davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
	segoon@...nwall.com, netdev@...r.kernel.org
Subject: Re: [PATCH] inet: ping: Fix icmp out counting

Next time, please tag the patch as [PATCH net]. See:

https://docs.kernel.org/process/maintainer-netdev.html

On Wed, Dec 24, 2025 at 02:31:45PM +0800, yuan.gao@...oud.cn wrote:
> From: "yuan.gao" <yuan.gao@...oud.cn>
> 
> When the ping program uses an IPPROTO_ICMP socket to send ICMP_ECHO
> messages, ICMP_MIB_OUTMSGS is counted twice.
> 
>     ping_v4_sendmsg
>       ping_v4_push_pending_frames
>         ip_push_pending_frames
>           ip_finish_skb
>             __ip_make_skb
>               icmp_out_count(net, icmp_type); // first count
>       icmp_out_count(sock_net(sk), user_icmph.type); // second count
> 
> However, when the ping program uses an IPPROTO_RAW socket,
> ICMP_MIB_OUTMSGS is counted correctly only once.
> 
> Therefore, the first count should be removed.

Looks correct.

Before:

# sysctl -wq net.ipv4.ping_group_range="0 4294967294"
# nstat -z -j | jq '.[]["IcmpOutEchos"]'
0
# ping -c1 127.0.0.1 &> /dev/null
# nstat -z -j | jq '.[]["IcmpOutEchos"]'
2

After:

# sysctl -wq net.ipv4.ping_group_range="0 4294967294"
# nstat -z -j | jq '.[]["IcmpOutEchos"]'
0
# ping -c1 127.0.0.1 &> /dev/null
# nstat -z -j | jq '.[]["IcmpOutEchos"]'
1

And it's consistent with IPv6:

# sysctl -wq net.ipv4.ping_group_range="0 4294967294"
# nstat -z -j | jq '.[]["Icmp6OutEchos"]'
0
# ping -c1 ::1 &> /dev/null
# nstat -z -j | jq '.[]["Icmp6OutEchos"]'
1

> 
> Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
> Signed-off-by: yuan.gao <yuan.gao@...oud.cn>

Reviewed-by: Ido Schimmel <idosch@...dia.com>
Tested-by: Ido Schimmel <idosch@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ