tcp: move ir_mark initialization to tcp_openreq_init
authorOctavian Purdila <octavian.purdila@intel.com>
Tue, 17 Jun 2014 08:25:37 +0000 (11:25 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Jun 2014 22:30:54 +0000 (15:30 -0700)
ir_mark initialization is done for both TCP v4 and v6, move it in the
common tcp_openreq_init function.

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 7286db80e8b8b6532cb4148a283f2f6d8eb3b530..06a3023080c0c5ca3567dadcd42a6317654edd47 100644 (file)
@@ -1098,7 +1098,7 @@ static inline int tcp_full_space(const struct sock *sk)
 
 static inline void tcp_openreq_init(struct request_sock *req,
                                    struct tcp_options_received *rx_opt,
-                                   struct sk_buff *skb)
+                                   struct sk_buff *skb, struct sock *sk)
 {
        struct inet_request_sock *ireq = inet_rsk(req);
 
@@ -1117,6 +1117,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
        ireq->ecn_ok = 0;
        ireq->ir_rmt_port = tcp_hdr(skb)->source;
        ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
+       ireq->ir_mark = inet_request_mark(sk, skb);
 }
 
 extern void tcp_openreq_init_rwin(struct request_sock *req,
index 77cccda1ad0c6dc62c8cb70d932eca2322304c81..180336d47df6c24d4baeb8f68e84951eec428b67 100644 (file)
@@ -1311,14 +1311,13 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                tcp_clear_options(&tmp_opt);
 
        tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
-       tcp_openreq_init(req, &tmp_opt, skb);
+       tcp_openreq_init(req, &tmp_opt, skb, sk);
 
        ireq = inet_rsk(req);
        ireq->ir_loc_addr = daddr;
        ireq->ir_rmt_addr = saddr;
        ireq->no_srccheck = inet_sk(sk)->transparent;
        ireq->opt = tcp_v4_save_options(skb);
-       ireq->ir_mark = inet_request_mark(sk, skb);
 
        if (security_inet_conn_request(sk, skb, req))
                goto drop_and_free;
index 229239ad96b1645de84bfc5b0ad76311e295f82c..08ae3da0db4a2c5a6f8e3b8555a409682d0ab916 100644 (file)
@@ -1025,7 +1025,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
                tcp_clear_options(&tmp_opt);
 
        tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
-       tcp_openreq_init(req, &tmp_opt, skb);
+       tcp_openreq_init(req, &tmp_opt, skb, sk);
 
        ireq = inet_rsk(req);
        ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
@@ -1034,7 +1034,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
                TCP_ECN_create_request(req, skb, sock_net(sk));
 
        ireq->ir_iif = sk->sk_bound_dev_if;
-       ireq->ir_mark = inet_request_mark(sk, skb);
 
        /* So that link locals have meaning */
        if (!sk->sk_bound_dev_if &&