aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_fragment.c22
1 files changed, 15 insertions, 7 deletions
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