tcp: get_cookie_sock() consolidation
IPv4 and IPv6 share same implementation of get_cookie_sock(), and there is no point inlining it. We add tcp_ prefix to the common helper name and export it. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
13ea657806
commit
b80c0e7858
@@ -469,6 +469,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
|
|||||||
void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
|
void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
|
||||||
|
|
||||||
/* From syncookies.c */
|
/* From syncookies.c */
|
||||||
|
struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
||||||
|
struct request_sock *req,
|
||||||
|
struct dst_entry *dst);
|
||||||
int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
|
int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
|
||||||
u32 cookie);
|
u32 cookie);
|
||||||
struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
|
struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(__cookie_v4_check);
|
EXPORT_SYMBOL_GPL(__cookie_v4_check);
|
||||||
|
|
||||||
static struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
||||||
struct request_sock *req,
|
struct request_sock *req,
|
||||||
struct dst_entry *dst)
|
struct dst_entry *dst)
|
||||||
{
|
{
|
||||||
@@ -235,7 +235,7 @@ static struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(tcp_get_cookie_sock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* when syncookies are in effect and tcp timestamps are enabled we stored
|
* when syncookies are in effect and tcp timestamps are enabled we stored
|
||||||
@@ -391,7 +391,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
|
|||||||
ireq->rcv_wscale = rcv_wscale;
|
ireq->rcv_wscale = rcv_wscale;
|
||||||
ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), &rt->dst);
|
ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), &rt->dst);
|
||||||
|
|
||||||
ret = get_cookie_sock(sk, skb, req, &rt->dst);
|
ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst);
|
||||||
/* ip_queue_xmit() depends on our flow being setup
|
/* ip_queue_xmit() depends on our flow being setup
|
||||||
* Normal sockets get it right from inet_csk_route_child_sock()
|
* Normal sockets get it right from inet_csk_route_child_sock()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,23 +41,6 @@ static __u16 const msstab[] = {
|
|||||||
9000 - 60,
|
9000 - 60,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
|
||||||
struct request_sock *req,
|
|
||||||
struct dst_entry *dst)
|
|
||||||
{
|
|
||||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
|
||||||
struct sock *child;
|
|
||||||
|
|
||||||
child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst);
|
|
||||||
if (child) {
|
|
||||||
atomic_set(&req->rsk_refcnt, 1);
|
|
||||||
inet_csk_reqsk_queue_add(sk, req, child);
|
|
||||||
} else {
|
|
||||||
reqsk_free(req);
|
|
||||||
}
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS],
|
static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS],
|
||||||
ipv6_cookie_scratch);
|
ipv6_cookie_scratch);
|
||||||
|
|
||||||
@@ -264,7 +247,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
|
|||||||
ireq->rcv_wscale = rcv_wscale;
|
ireq->rcv_wscale = rcv_wscale;
|
||||||
ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst);
|
ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst);
|
||||||
|
|
||||||
ret = get_cookie_sock(sk, skb, req, dst);
|
ret = tcp_get_cookie_sock(sk, skb, req, dst);
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
out_free:
|
out_free:
|
||||||
|
|||||||
Reference in New Issue
Block a user