aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ipv6.h4
-rw-r--r--net/ipv4/ip_fragment.c22
2 files changed, 17 insertions, 9 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a0909c79374b..51a068ad064b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -292,8 +292,8 @@ static inline int ip6_frag_mem(struct net *net)
292} 292}
293#endif 293#endif
294 294
295#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ 295#define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */
296#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ 296#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
297#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 297#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
298 298
299extern int __ipv6_addr_type(const struct in6_addr *addr); 299extern int __ipv6_addr_type(const struct in6_addr *addr);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index eb9d63a570cd..f55a4e61bfb8 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -851,14 +851,22 @@ static inline void ip4_frags_ctl_register(void)
851 851
852static int __net_init ipv4_frags_init_net(struct net *net) 852static int __net_init ipv4_frags_init_net(struct net *net)
853{ 853{
854 /* 854 /* Fragment cache limits.
855 * Fragment cache limits. We will commit 256K at one time. Should we 855 *
856 * cross that limit we will prune down to 192K. This should cope with 856 * The fragment memory accounting code, (tries to) account for
857 * even the most extreme cases without allowing an attacker to 857 * the real memory usage, by measuring both the size of frag
858 * measurably harm machine performance. 858 * queue struct (inet_frag_queue (ipv4:ipq/ipv6:frag_queue))
859 * and the SKB's truesize.
860 *
861 * A 64K fragment consumes 129736 bytes (44*2944)+200
862 * (1500 truesize == 2944, sizeof(struct ipq) == 200)
863 *
864 * We will commit 4MB at one time. Should we cross that limit
865 * we will prune down to 3MB, making room for approx 8 big 64K
866 * fragments 8x128k.
859 */ 867 */
860 net->ipv4.frags.high_thresh = 256 * 1024; 868 net->ipv4.frags.high_thresh = 4 * 1024 * 1024;
861 net->ipv4.frags.low_thresh = 192 * 1024; 869 net->ipv4.frags.low_thresh = 3 * 1024 * 1024;
862 /* 870 /*
863 * Important NOTE! Fragment queue must be destroyed before MSL expires. 871 * Important NOTE! Fragment queue must be destroyed before MSL expires.
864 * RFC791 is wrong proposing to prolongate timer each fragment arrival 872 * RFC791 is wrong proposing to prolongate timer each fragment arrival