mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
ipv6: icmp: icmpv6_xrlim_allow() optimization if net.ipv6.icmp.ratelimit is zero
If net.ipv6.icmp.ratelimit is zero we do not have to call inet_getpeer_v6() and inet_peer_xrlim_allow(). Both can be very expensive under DDOS. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260216142832.3834174-6-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d8d9ef2988
commit
9395b1bb1f
1 changed files with 6 additions and 2 deletions
|
|
@ -220,8 +220,12 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
|
|||
int tmo = READ_ONCE(net->ipv6.sysctl.icmpv6_time);
|
||||
struct inet_peer *peer;
|
||||
|
||||
peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr);
|
||||
res = inet_peer_xrlim_allow(peer, tmo);
|
||||
if (!tmo) {
|
||||
res = true;
|
||||
} else {
|
||||
peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr);
|
||||
res = inet_peer_xrlim_allow(peer, tmo);
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
if (!res)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue