X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Fnetfilter%2Fip_nat_helper.c;h=d7ee32f05b6d1db6b2729aa51d4f021abd7281a0;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=a49c722adbc195f8647f9b1228b272444774ffd8;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index a49c722ad..d7ee32f05 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c @@ -47,6 +47,7 @@ #define DUMP_OFFSET(x) #endif +static LIST_HEAD(helpers); DECLARE_LOCK(ip_nat_seqofs_lock); /* Setup TCP sequence correction given this change at this sequence */ @@ -72,7 +73,7 @@ adjust_tcp_sequence(u32 seq, LOCK_BH(&ip_nat_seqofs_lock); - /* SYN adjust. If it's uninitialized, of this is after last + /* SYN adjust. If it's uninitialized, or this is after last * correction, record it: we don't handle more than one * adjustment in the window, but do deal with common case of a * retransmit */ @@ -346,7 +347,7 @@ ip_nat_sack_adjust(struct sk_buff **pskb, return 1; } -/* TCP sequence number adjustment. Returns true or false. */ +/* TCP sequence number adjustment. Returns 1 on success, 0 on failure */ int ip_nat_seq_adjust(struct sk_buff **pskb, struct ip_conntrack *ct, @@ -395,7 +396,12 @@ ip_nat_seq_adjust(struct sk_buff **pskb, tcph->seq = newseq; tcph->ack_seq = newack; - return ip_nat_sack_adjust(pskb, tcph, ct, ctinfo); + if (!ip_nat_sack_adjust(pskb, tcph, ct, ctinfo)) + return 0; + + ip_conntrack_tcp_update(*pskb, ct, dir); + + return 1; } static inline int @@ -419,6 +425,24 @@ int ip_nat_helper_register(struct ip_nat_helper *me) return ret; } +struct ip_nat_helper * +__ip_nat_find_helper(const struct ip_conntrack_tuple *tuple) +{ + return LIST_FIND(&helpers, helper_cmp, struct ip_nat_helper *, tuple); +} + +struct ip_nat_helper * +ip_nat_find_helper(const struct ip_conntrack_tuple *tuple) +{ + struct ip_nat_helper *h; + + READ_LOCK(&ip_nat_lock); + h = __ip_nat_find_helper(tuple); + READ_UNLOCK(&ip_nat_lock); + + return h; +} + static int kill_helper(const struct ip_conntrack *i, void *helper) {