tcp: add init_seq method to tcp_request_sock_ops
authorOctavian Purdila <octavian.purdila@intel.com>
Wed, 25 Jun 2014 14:09:57 +0000 (17:09 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Jun 2014 22:53:36 +0000 (15:53 -0700)
More work in preparation of unifying tcp_v4_conn_request and
tcp_v6_conn_request: indirect the init sequence calls via the
tcp_request_sock_ops.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index 59fcc5934c79f3a8d7e16718154cb7a76bdfe3d4..8cacf0d6ed4db6e947e74e47b40230bdb7e58712 100644 (file)
@@ -1608,6 +1608,7 @@ struct tcp_request_sock_ops {
        struct dst_entry *(*route_req)(struct sock *sk, struct flowi *fl,
                                       const struct request_sock *req,
                                       bool *strict);
+       __u32 (*init_seq)(const struct sk_buff *skb);
 };
 
 #ifdef CONFIG_SYN_COOKIES
index 54fbbd8b4fcda88fadd8399245995e9e40fbf77a..43478265006a287c89561b63e288c6a8ba48e095 100644 (file)
@@ -99,7 +99,7 @@ static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
 struct inet_hashinfo tcp_hashinfo;
 EXPORT_SYMBOL(tcp_hashinfo);
 
-static inline __u32 tcp_v4_init_sequence(const struct sk_buff *skb)
+static  __u32 tcp_v4_init_sequence(const struct sk_buff *skb)
 {
        return secure_tcp_sequence_number(ip_hdr(skb)->daddr,
                                          ip_hdr(skb)->saddr,
@@ -1284,6 +1284,7 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
        .cookie_init_seq =      cookie_v4_init_sequence,
 #endif
        .route_req      =       tcp_v4_route_req,
+       .init_seq       =       tcp_v4_init_sequence,
 };
 
 int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
@@ -1391,7 +1392,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                        goto drop_and_release;
                }
 
-               isn = tcp_v4_init_sequence(skb);
+               isn = af_ops->init_seq(skb);
        }
        if (!dst) {
                dst = af_ops->route_req(sk, (struct flowi *)&fl4, req, NULL);
index 91b8a2e699f3a4f1b5b1b197c7a38e27f3f70b13..2fd886fe834093f17da9cf7095284542dea5c854 100644 (file)
@@ -775,6 +775,7 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
        .cookie_init_seq =      cookie_v6_init_sequence,
 #endif
        .route_req      =       tcp_v6_route_req,
+       .init_seq       =       tcp_v6_init_sequence,
 };
 
 static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
@@ -1114,7 +1115,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
                        goto drop_and_release;
                }
 
-               isn = tcp_v6_init_sequence(skb);
+               isn = af_ops->init_seq(skb);
        }
 
        if (!dst) {