aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/tcp.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 74efeda994b3..869637a7caf7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1666,4 +1666,24 @@ int tcpv4_offload_init(void);
1666void tcp_v4_init(void); 1666void tcp_v4_init(void);
1667void tcp_init(void); 1667void tcp_init(void);
1668 1668
1669/*
1670 * Save and compile IPv4 options, return a pointer to it
1671 */
1672static inline struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
1673{
1674 const struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
1675 struct ip_options_rcu *dopt = NULL;
1676
1677 if (opt && opt->optlen) {
1678 int opt_size = sizeof(*dopt) + opt->optlen;
1679
1680 dopt = kmalloc(opt_size, GFP_ATOMIC);
1681 if (dopt && __ip_options_echo(&dopt->opt, skb, opt)) {
1682 kfree(dopt);
1683 dopt = NULL;
1684 }
1685 }
1686 return dopt;
1687}
1688
1669#endif /* _TCP_H */ 1689#endif /* _TCP_H */