|
@@ -191,7 +191,8 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
|
|
ct, ctinfo);
|
|
ct, ctinfo);
|
|
/* Tell TCP window tracking about seq change */
|
|
/* Tell TCP window tracking about seq change */
|
|
nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
|
|
nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
|
|
- ct, CTINFO2DIR(ctinfo));
|
|
|
|
|
|
+ ct, CTINFO2DIR(ctinfo),
|
|
|
|
+ (int)rep_len - (int)match_len);
|
|
|
|
|
|
nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
|
|
nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
|
|
}
|
|
}
|
|
@@ -377,6 +378,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
|
|
struct tcphdr *tcph;
|
|
struct tcphdr *tcph;
|
|
int dir;
|
|
int dir;
|
|
__be32 newseq, newack;
|
|
__be32 newseq, newack;
|
|
|
|
+ s16 seqoff, ackoff;
|
|
struct nf_conn_nat *nat = nfct_nat(ct);
|
|
struct nf_conn_nat *nat = nfct_nat(ct);
|
|
struct nf_nat_seq *this_way, *other_way;
|
|
struct nf_nat_seq *this_way, *other_way;
|
|
|
|
|
|
@@ -390,15 +392,18 @@ nf_nat_seq_adjust(struct sk_buff *skb,
|
|
|
|
|
|
tcph = (void *)skb->data + ip_hdrlen(skb);
|
|
tcph = (void *)skb->data + ip_hdrlen(skb);
|
|
if (after(ntohl(tcph->seq), this_way->correction_pos))
|
|
if (after(ntohl(tcph->seq), this_way->correction_pos))
|
|
- newseq = htonl(ntohl(tcph->seq) + this_way->offset_after);
|
|
|
|
|
|
+ seqoff = this_way->offset_after;
|
|
else
|
|
else
|
|
- newseq = htonl(ntohl(tcph->seq) + this_way->offset_before);
|
|
|
|
|
|
+ seqoff = this_way->offset_before;
|
|
|
|
|
|
if (after(ntohl(tcph->ack_seq) - other_way->offset_before,
|
|
if (after(ntohl(tcph->ack_seq) - other_way->offset_before,
|
|
other_way->correction_pos))
|
|
other_way->correction_pos))
|
|
- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after);
|
|
|
|
|
|
+ ackoff = other_way->offset_after;
|
|
else
|
|
else
|
|
- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
|
|
|
|
|
|
+ ackoff = other_way->offset_before;
|
|
|
|
+
|
|
|
|
+ newseq = htonl(ntohl(tcph->seq) + seqoff);
|
|
|
|
+ newack = htonl(ntohl(tcph->ack_seq) - ackoff);
|
|
|
|
|
|
inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
|
|
inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
|
|
inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
|
|
inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
|
|
@@ -413,7 +418,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
|
|
if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo))
|
|
if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo))
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir);
|
|
|
|
|
|
+ nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir, seqoff);
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|