Jelajahi Sumber

IPv6: reassembly: replace magic number with macro definitions

Use macro to define high/low thresh value, refer to IPV6_FRAG_TIMEOUT.

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Shan Wei 15 tahun lalu
induk
melakukan
7c070aa947
3 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 2 0
      include/net/ipv6.h
  2. 2 2
      net/ipv6/netfilter/nf_conntrack_reasm.c
  3. 2 2
      net/ipv6/reassembly.c

+ 2 - 0
include/net/ipv6.h

@@ -246,6 +246,8 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
 int ip6_frag_nqueues(struct net *net);
 int ip6_frag_nqueues(struct net *net);
 int ip6_frag_mem(struct net *net);
 int ip6_frag_mem(struct net *net);
 
 
+#define IPV6_FRAG_HIGH_THRESH	262144		/* == 256*1024 */
+#define IPV6_FRAG_LOW_THRESH	196608		/* == 192*1024 */
 #define IPV6_FRAG_TIMEOUT	(60*HZ)		/* 60 seconds */
 #define IPV6_FRAG_TIMEOUT	(60*HZ)		/* 60 seconds */
 
 
 extern int __ipv6_addr_type(const struct in6_addr *addr);
 extern int __ipv6_addr_type(const struct in6_addr *addr);

+ 2 - 2
net/ipv6/netfilter/nf_conntrack_reasm.c

@@ -666,8 +666,8 @@ int nf_ct_frag6_init(void)
 	nf_frags.frag_expire = nf_ct_frag6_expire;
 	nf_frags.frag_expire = nf_ct_frag6_expire;
 	nf_frags.secret_interval = 10 * 60 * HZ;
 	nf_frags.secret_interval = 10 * 60 * HZ;
 	nf_init_frags.timeout = IPV6_FRAG_TIMEOUT;
 	nf_init_frags.timeout = IPV6_FRAG_TIMEOUT;
-	nf_init_frags.high_thresh = 256 * 1024;
-	nf_init_frags.low_thresh = 192 * 1024;
+	nf_init_frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
+	nf_init_frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	inet_frags_init_net(&nf_init_frags);
 	inet_frags_init_net(&nf_init_frags);
 	inet_frags_init(&nf_frags);
 	inet_frags_init(&nf_frags);
 
 

+ 2 - 2
net/ipv6/reassembly.c

@@ -747,8 +747,8 @@ static inline void ip6_frags_sysctl_unregister(void)
 
 
 static int ipv6_frags_init_net(struct net *net)
 static int ipv6_frags_init_net(struct net *net)
 {
 {
-	net->ipv6.frags.high_thresh = 256 * 1024;
-	net->ipv6.frags.low_thresh = 192 * 1024;
+	net->ipv6.frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
+	net->ipv6.frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT;
 	net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT;
 
 
 	inet_frags_init_net(&net->ipv6.frags);
 	inet_frags_init_net(&net->ipv6.frags);