Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6_tunnel: Rate limit warning messages

The warning messages can be invoked from the data path for every packet
transmitted through an ip6gre netdev, leading to high CPU utilization.

Fix that by rate limiting the messages.

Fixes: 09c6bbf090ec ("[IPV6]: Do mandatory IPv6 tunnel endpoint checks in realtime")
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Tested-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
6cee105e e2f08207

+4 -4
+4 -4
net/ipv6/ip6_tunnel.c
··· 1036 1036 1037 1037 if (unlikely(!ipv6_chk_addr_and_flags(net, laddr, ldev, false, 1038 1038 0, IFA_F_TENTATIVE))) 1039 - pr_warn("%s xmit: Local address not yet configured!\n", 1040 - p->name); 1039 + pr_warn_ratelimited("%s xmit: Local address not yet configured!\n", 1040 + p->name); 1041 1041 else if (!(p->flags & IP6_TNL_F_ALLOW_LOCAL_REMOTE) && 1042 1042 !ipv6_addr_is_multicast(raddr) && 1043 1043 unlikely(ipv6_chk_addr_and_flags(net, raddr, ldev, 1044 1044 true, 0, IFA_F_TENTATIVE))) 1045 - pr_warn("%s xmit: Routing loop! Remote address found on this node!\n", 1046 - p->name); 1045 + pr_warn_ratelimited("%s xmit: Routing loop! Remote address found on this node!\n", 1046 + p->name); 1047 1047 else 1048 1048 ret = 1; 1049 1049 rcu_read_unlock();