summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-08-29 17:46:40 +0300
committerSasha Levin <sashal@kernel.org>2026-03-04 15:20:07 +0300
commitde5703be2c61e6a90c5b91dfc852a5a09e1026c2 (patch)
tree7886f6957474c9f1fcd10bb0803b4c29c66a3f59 /include
parent721eb342d9ba19bad5c4815ea3921465158b7362 (diff)
downloadlinux-de5703be2c61e6a90c5b91dfc852a5a09e1026c2.tar.xz
icmp: move icmp_global.credit and icmp_global.stamp to per netns storage
[ Upstream commit b056b4cd9178f7a1d5d57f7b48b073c29729ddaa ] Host wide ICMP ratelimiter should be per netns, to provide better isolation. Following patch in this series makes the sysctl per netns. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20240829144641.3880376-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 034bbd806298 ("icmp: prevent possible overflow in icmp_global_allow()") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip.h4
-rw-r--r--include/net/netns/ipv4.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 4ee23eb0814a..86ae58408148 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -785,8 +785,8 @@ static inline void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb)
ip_cmsg_recv_offset(msg, skb->sk, skb, 0, 0);
}
-bool icmp_global_allow(void);
-void icmp_global_consume(void);
+bool icmp_global_allow(struct net *net);
+void icmp_global_consume(struct net *net);
extern int sysctl_icmp_msgs_per_sec;
extern int sysctl_icmp_msgs_burst;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ede2ff1da53a..45988bea57cb 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -83,7 +83,8 @@ struct netns_ipv4 {
u8 sysctl_icmp_errors_use_inbound_ifaddr;
int sysctl_icmp_ratelimit;
int sysctl_icmp_ratemask;
-
+ atomic_t icmp_global_credit;
+ u32 icmp_global_stamp;
u32 ip_rt_min_pmtu;
int ip_rt_mtu_expires;
int ip_rt_min_advmss;