|
@@ -29,6 +29,7 @@
|
|
|
#include <net/netfilter/nf_conntrack_ecache.h>
|
|
|
#include <net/netfilter/nf_conntrack_seqadj.h>
|
|
|
#include <net/netfilter/nf_conntrack_synproxy.h>
|
|
|
+#include <net/netfilter/nf_conntrack_timeout.h>
|
|
|
#include <net/netfilter/nf_log.h>
|
|
|
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
|
|
|
#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
|
|
@@ -768,27 +769,21 @@ static int tcp_error(struct net *net, struct nf_conn *tmpl,
|
|
|
return NF_ACCEPT;
|
|
|
}
|
|
|
|
|
|
-static unsigned int *tcp_get_timeouts(struct net *net)
|
|
|
-{
|
|
|
- return tcp_pernet(net)->timeouts;
|
|
|
-}
|
|
|
-
|
|
|
/* Returns verdict for packet, or -1 for invalid. */
|
|
|
static int tcp_packet(struct nf_conn *ct,
|
|
|
const struct sk_buff *skb,
|
|
|
unsigned int dataoff,
|
|
|
- enum ip_conntrack_info ctinfo,
|
|
|
- unsigned int *timeouts)
|
|
|
+ enum ip_conntrack_info ctinfo)
|
|
|
{
|
|
|
struct net *net = nf_ct_net(ct);
|
|
|
struct nf_tcp_net *tn = tcp_pernet(net);
|
|
|
struct nf_conntrack_tuple *tuple;
|
|
|
enum tcp_conntrack new_state, old_state;
|
|
|
+ unsigned int index, *timeouts;
|
|
|
enum ip_conntrack_dir dir;
|
|
|
const struct tcphdr *th;
|
|
|
struct tcphdr _tcph;
|
|
|
unsigned long timeout;
|
|
|
- unsigned int index;
|
|
|
|
|
|
th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph);
|
|
|
BUG_ON(th == NULL);
|
|
@@ -1021,6 +1016,10 @@ static int tcp_packet(struct nf_conn *ct,
|
|
|
&& new_state == TCP_CONNTRACK_FIN_WAIT)
|
|
|
ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
|
|
|
|
|
|
+ timeouts = nf_ct_timeout_lookup(ct);
|
|
|
+ if (!timeouts)
|
|
|
+ timeouts = tn->timeouts;
|
|
|
+
|
|
|
if (ct->proto.tcp.retrans >= tn->tcp_max_retrans &&
|
|
|
timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
|
|
|
timeout = timeouts[TCP_CONNTRACK_RETRANS];
|
|
@@ -1070,7 +1069,7 @@ static int tcp_packet(struct nf_conn *ct,
|
|
|
|
|
|
/* Called when a new connection for this protocol found. */
|
|
|
static bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,
|
|
|
- unsigned int dataoff, unsigned int *timeouts)
|
|
|
+ unsigned int dataoff)
|
|
|
{
|
|
|
enum tcp_conntrack new_state;
|
|
|
const struct tcphdr *th;
|
|
@@ -1288,10 +1287,12 @@ static unsigned int tcp_nlattr_tuple_size(void)
|
|
|
static int tcp_timeout_nlattr_to_obj(struct nlattr *tb[],
|
|
|
struct net *net, void *data)
|
|
|
{
|
|
|
- unsigned int *timeouts = data;
|
|
|
struct nf_tcp_net *tn = tcp_pernet(net);
|
|
|
+ unsigned int *timeouts = data;
|
|
|
int i;
|
|
|
|
|
|
+ if (!timeouts)
|
|
|
+ timeouts = tn->timeouts;
|
|
|
/* set default TCP timeouts. */
|
|
|
for (i=0; i<TCP_CONNTRACK_TIMEOUT_MAX; i++)
|
|
|
timeouts[i] = tn->timeouts[i];
|
|
@@ -1538,7 +1539,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 =
|
|
|
.print_conntrack = tcp_print_conntrack,
|
|
|
#endif
|
|
|
.packet = tcp_packet,
|
|
|
- .get_timeouts = tcp_get_timeouts,
|
|
|
.new = tcp_new,
|
|
|
.error = tcp_error,
|
|
|
.can_early_drop = tcp_can_early_drop,
|
|
@@ -1574,7 +1574,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 =
|
|
|
.print_conntrack = tcp_print_conntrack,
|
|
|
#endif
|
|
|
.packet = tcp_packet,
|
|
|
- .get_timeouts = tcp_get_timeouts,
|
|
|
.new = tcp_new,
|
|
|
.error = tcp_error,
|
|
|
.can_early_drop = tcp_can_early_drop,
|