aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-24 18:58:56 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-24 21:16:30 -0400
commitfd3a154a00fb991872680f19021f5edbb40b4dbe (patch)
tree5d0b22e1e707f9ea3dcd0c3062eaaed59bc331e2 /net/ipv4/tcp_ipv4.c
parent39f8e58e53be32ab758d30536e0bd2e6ce766462 (diff)
tcp: md5: get rid of tcp_v[46]_reqsk_md5_lookup()
With request socks convergence, we no longer need different lookup methods. A request socket can use generic lookup function. Add const qualifier to 2nd tcp_v[46]_md5_lookup() parameter. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 79d5c641688c..fc8995a702a6 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -898,10 +898,10 @@ struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
898 const union tcp_md5_addr *addr, 898 const union tcp_md5_addr *addr,
899 int family) 899 int family)
900{ 900{
901 struct tcp_sock *tp = tcp_sk(sk); 901 const struct tcp_sock *tp = tcp_sk(sk);
902 struct tcp_md5sig_key *key; 902 struct tcp_md5sig_key *key;
903 unsigned int size = sizeof(struct in_addr); 903 unsigned int size = sizeof(struct in_addr);
904 struct tcp_md5sig_info *md5sig; 904 const struct tcp_md5sig_info *md5sig;
905 905
906 /* caller either holds rcu_read_lock() or socket lock */ 906 /* caller either holds rcu_read_lock() or socket lock */
907 md5sig = rcu_dereference_check(tp->md5sig_info, 907 md5sig = rcu_dereference_check(tp->md5sig_info,
@@ -924,24 +924,15 @@ struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
924EXPORT_SYMBOL(tcp_md5_do_lookup); 924EXPORT_SYMBOL(tcp_md5_do_lookup);
925 925
926struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 926struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
927 struct sock *addr_sk) 927 const struct sock *addr_sk)
928{ 928{
929 union tcp_md5_addr *addr; 929 union tcp_md5_addr *addr;
930 930
931 addr = (union tcp_md5_addr *)&inet_sk(addr_sk)->inet_daddr; 931 addr = (union tcp_md5_addr *)&sk->sk_daddr;
932 return tcp_md5_do_lookup(sk, addr, AF_INET); 932 return tcp_md5_do_lookup(sk, addr, AF_INET);
933} 933}
934EXPORT_SYMBOL(tcp_v4_md5_lookup); 934EXPORT_SYMBOL(tcp_v4_md5_lookup);
935 935
936static struct tcp_md5sig_key *tcp_v4_reqsk_md5_lookup(struct sock *sk,
937 struct request_sock *req)
938{
939 union tcp_md5_addr *addr;
940
941 addr = (union tcp_md5_addr *)&inet_rsk(req)->ir_rmt_addr;
942 return tcp_md5_do_lookup(sk, addr, AF_INET);
943}
944
945/* This can be called on a newly created socket, from other files */ 936/* This can be called on a newly created socket, from other files */
946int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, 937int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
947 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp) 938 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp)
@@ -1247,7 +1238,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = {
1247static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { 1238static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
1248 .mss_clamp = TCP_MSS_DEFAULT, 1239 .mss_clamp = TCP_MSS_DEFAULT,
1249#ifdef CONFIG_TCP_MD5SIG 1240#ifdef CONFIG_TCP_MD5SIG
1250 .md5_lookup = tcp_v4_reqsk_md5_lookup, 1241 .req_md5_lookup = tcp_v4_md5_lookup,
1251 .calc_md5_hash = tcp_v4_md5_hash_skb, 1242 .calc_md5_hash = tcp_v4_md5_hash_skb,
1252#endif 1243#endif
1253 .init_req = tcp_v4_init_req, 1244 .init_req = tcp_v4_init_req,