Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Dumazet and committed by
David S. Miller
b80c0e78 13ea6578

+9 -23
+3
include/net/tcp.h
··· 469 469 void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb); 470 470 471 471 /* From syncookies.c */ 472 + struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb, 473 + struct request_sock *req, 474 + struct dst_entry *dst); 472 475 int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 473 476 u32 cookie); 474 477 struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
+5 -5
net/ipv4/syncookies.c
··· 219 219 } 220 220 EXPORT_SYMBOL_GPL(__cookie_v4_check); 221 221 222 - static struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, 223 - struct request_sock *req, 224 - struct dst_entry *dst) 222 + struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb, 223 + struct request_sock *req, 224 + struct dst_entry *dst) 225 225 { 226 226 struct inet_connection_sock *icsk = inet_csk(sk); 227 227 struct sock *child; ··· 235 235 } 236 236 return child; 237 237 } 238 - 238 + EXPORT_SYMBOL(tcp_get_cookie_sock); 239 239 240 240 /* 241 241 * when syncookies are in effect and tcp timestamps are enabled we stored ··· 391 391 ireq->rcv_wscale = rcv_wscale; 392 392 ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), &rt->dst); 393 393 394 - ret = get_cookie_sock(sk, skb, req, &rt->dst); 394 + ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst); 395 395 /* ip_queue_xmit() depends on our flow being setup 396 396 * Normal sockets get it right from inet_csk_route_child_sock() 397 397 */
+1 -18
net/ipv6/syncookies.c
··· 41 41 9000 - 60, 42 42 }; 43 43 44 - static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, 45 - struct request_sock *req, 46 - struct dst_entry *dst) 47 - { 48 - struct inet_connection_sock *icsk = inet_csk(sk); 49 - struct sock *child; 50 - 51 - child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst); 52 - if (child) { 53 - atomic_set(&req->rsk_refcnt, 1); 54 - inet_csk_reqsk_queue_add(sk, req, child); 55 - } else { 56 - reqsk_free(req); 57 - } 58 - return child; 59 - } 60 - 61 44 static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], 62 45 ipv6_cookie_scratch); 63 46 ··· 247 264 ireq->rcv_wscale = rcv_wscale; 248 265 ireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst); 249 266 250 - ret = get_cookie_sock(sk, skb, req, dst); 267 + ret = tcp_get_cookie_sock(sk, skb, req, dst); 251 268 out: 252 269 return ret; 253 270 out_free: