diff options
author | Sachin Saxena <sachin.saxena@freescale.com> | 2013-03-04 10:24:25 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-04-03 21:28:44 (GMT) |
commit | 4b8566e1321be5169322a25fc627cc68222c3e7c (patch) | |
tree | 4e5f848ba9b1ac7246cee1cf45bbef28e3f910ed | |
parent | 772bf4a78d23b9452c30de5a0a3f596ce3955edc (diff) | |
download | linux-fsl-qoriq-4b8566e1321be5169322a25fc627cc68222c3e7c.tar.xz |
netfilter/ipv4: Offload TCP session information in ip_ct_tcp_state
Passing TCP session information in the ip_ct_tcp_state structure
which is used by packet offload engine for handling offloaded
TCP sessions.
Signed-off-by: Arun Pathak <arun.pathak@freescale.com>
Signed-off-by: Sachin Saxena <sachin.saxena@freescale.com>
Change-Id: I68b7d315971dc6e8d7a40cd7ccdbc71813c10b1e
Reviewed-on: http://git.am.freescale.net:8181/877
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
-rw-r--r-- | include/linux/netfilter/nf_conntrack_tcp.h | 6 | ||||
-rw-r--r-- | net/ipv4/ip_options.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_tcp.c | 42 |
3 files changed, 48 insertions, 2 deletions
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 22db961..781a68d 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h @@ -11,6 +11,12 @@ struct ip_ct_tcp_state { u_int32_t td_maxack; /* max of ack */ u_int8_t td_scale; /* window scale factor */ u_int8_t flags; /* per direction options */ +#ifdef CONFIG_AS_FASTPATH + u_int32_t td_tcptimestamp;/* Time Stamp */ + int32_t td_delta; /* for Packet mangling */ + /* Last window advertisement seen in dir */ + u_int32_t td_rcvwin; +#endif }; struct ip_ct_tcp { diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index fd72bd0..a47fc1d 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -604,9 +604,7 @@ void ip_forward_options(struct sk_buff *skb) ip_send_check(ip_hdr(skb)); } } -#ifdef CONFIG_AS_FASTPATH EXPORT_SYMBOL(ip_forward_options); -#endif int ip_options_rcv_srr(struct sk_buff *skb) { diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 83876e9..e4caf79 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c @@ -713,6 +713,48 @@ static bool tcp_in_window(const struct nf_conn *ct, state->retrans = 0; } } + +#ifdef CONFIG_AS_FASTPATH + state->seen[dir].td_delta = receiver_offset; + state->seen[dir].td_rcvwin = win; + /* Setting Time stamp */ + { + unsigned char *tcpopt; + unsigned char *endptr; + int optlen; + tcpopt = (unsigned char *)(tcph) + 20; + optlen = tcph->doff * 4 - 20; + if (optlen > 0) { + endptr = tcpopt + optlen; + while (tcpopt < endptr) { + if (tcpopt[1] <= 0) + break; + + switch (*tcpopt) { + case TCPOPT_EOL: + case TCPOPT_NOP: + tcpopt++; + break; + case TCPOPT_MSS: + tcpopt += 4; /* 4 byte option length */ + break; + case TCPOPT_WINDOW: + tcpopt += 3; /* 3 byte option length */ + break; + case TCPOPT_TIMESTAMP: + state->seen[dir].td_tcptimestamp = + ntohl(*((unsigned long *) + (tcpopt + 2))); + goto DONE; + default: + tcpopt += tcpopt[1]; + break; + } + } + } + } +DONE: +#endif res = true; } else { res = false; |