diff options
author | Eric Dumazet <edumazet@google.com> | 2024-08-29 14:46:40 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-30 11:14:06 -0700 |
commit | b056b4cd9178f7a1d5d57f7b48b073c29729ddaa (patch) | |
tree | c52e88f67befd08e2f9c751d342c850029ebfd73 /include | |
parent | 8c2bd38b95f75f3d2a08c93e35303e26d480d24e (diff) |
icmp: move icmp_global.credit and icmp_global.stamp to per netns storage
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ip.h | 4 | ||||
-rw-r--r-- | include/net/netns/ipv4.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 82248813619e..d3bca4e83979 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -794,8 +794,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 5fcd61ada622..54fe7c079fff 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -122,7 +122,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; |