void tcp_v4_init(void);
 void tcp_init(void);
 
+/*
+ * Save and compile IPv4 options, return a pointer to it
+ */
+static inline struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
+{
+       const struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
+       struct ip_options_rcu *dopt = NULL;
+
+       if (opt && opt->optlen) {
+               int opt_size = sizeof(*dopt) + opt->optlen;
+
+               dopt = kmalloc(opt_size, GFP_ATOMIC);
+               if (dopt && __ip_options_echo(&dopt->opt, skb, opt)) {
+                       kfree(dopt);
+                       dopt = NULL;
+               }
+       }
+       return dopt;
+}
+
 #endif /* _TCP_H */
 
        /* We throwed the options of the initial SYN away, so we hope
         * the ACK carries the same options again (see RFC1122 4.2.3.8)
         */
-       if (opt && opt->optlen) {
-               int opt_size = sizeof(struct ip_options_rcu) + opt->optlen;
-
-               ireq->opt = kmalloc(opt_size, GFP_ATOMIC);
-               if (ireq->opt != NULL && __ip_options_echo(&ireq->opt->opt, skb, opt)) {
-                       kfree(ireq->opt);
-                       ireq->opt = NULL;
-               }
-       }
+       ireq->opt = tcp_v4_save_options(skb);
 
        if (security_inet_conn_request(sk, skb, req)) {
                reqsk_free(req);
 
 }
 EXPORT_SYMBOL(tcp_syn_flood_action);
 
-/*
- * Save and compile IPv4 options into the request_sock if needed.
- */
-static struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
-{
-       const struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
-       struct ip_options_rcu *dopt = NULL;
-
-       if (opt && opt->optlen) {
-               int opt_size = sizeof(*dopt) + opt->optlen;
-
-               dopt = kmalloc(opt_size, GFP_ATOMIC);
-               if (dopt && __ip_options_echo(&dopt->opt, skb, opt)) {
-                       kfree(dopt);
-                       dopt = NULL;
-               }
-       }
-       return dopt;
-}
-
 #ifdef CONFIG_TCP_MD5SIG
 /*
  * RFC2385 MD5 checksumming requires a mapping of