aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r--net/ipv4/raw.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index e10ef6c2202a..b433b485a883 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -84,8 +84,9 @@ static struct raw_hashinfo raw_v4_hashinfo = {
84 .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), 84 .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
85}; 85};
86 86
87void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h) 87void raw_hash_sk(struct sock *sk)
88{ 88{
89 struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
89 struct hlist_head *head; 90 struct hlist_head *head;
90 91
91 head = &h->ht[inet_sk(sk)->num & (RAW_HTABLE_SIZE - 1)]; 92 head = &h->ht[inet_sk(sk)->num & (RAW_HTABLE_SIZE - 1)];
@@ -97,8 +98,10 @@ void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h)
97} 98}
98EXPORT_SYMBOL_GPL(raw_hash_sk); 99EXPORT_SYMBOL_GPL(raw_hash_sk);
99 100
100void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h) 101void raw_unhash_sk(struct sock *sk)
101{ 102{
103 struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
104
102 write_lock_bh(&h->lock); 105 write_lock_bh(&h->lock);
103 if (sk_del_node_init(sk)) 106 if (sk_del_node_init(sk))
104 sock_prot_inuse_add(sk->sk_prot, -1); 107 sock_prot_inuse_add(sk->sk_prot, -1);
@@ -106,16 +109,6 @@ void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h)
106} 109}
107EXPORT_SYMBOL_GPL(raw_unhash_sk); 110EXPORT_SYMBOL_GPL(raw_unhash_sk);
108 111
109static void raw_v4_hash(struct sock *sk)
110{
111 raw_hash_sk(sk, &raw_v4_hashinfo);
112}
113
114static void raw_v4_unhash(struct sock *sk)
115{
116 raw_unhash_sk(sk, &raw_v4_hashinfo);
117}
118
119static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, 112static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
120 unsigned short num, __be32 raddr, __be32 laddr, int dif) 113 unsigned short num, __be32 raddr, __be32 laddr, int dif)
121{ 114{
@@ -841,9 +834,10 @@ struct proto raw_prot = {
841 .recvmsg = raw_recvmsg, 834 .recvmsg = raw_recvmsg,
842 .bind = raw_bind, 835 .bind = raw_bind,
843 .backlog_rcv = raw_rcv_skb, 836 .backlog_rcv = raw_rcv_skb,
844 .hash = raw_v4_hash, 837 .hash = raw_hash_sk,
845 .unhash = raw_v4_unhash, 838 .unhash = raw_unhash_sk,
846 .obj_size = sizeof(struct raw_sock), 839 .obj_size = sizeof(struct raw_sock),
840 .h.raw_hash = &raw_v4_hashinfo,
847#ifdef CONFIG_COMPAT 841#ifdef CONFIG_COMPAT
848 .compat_setsockopt = compat_raw_setsockopt, 842 .compat_setsockopt = compat_raw_setsockopt,
849 .compat_getsockopt = compat_raw_getsockopt, 843 .compat_getsockopt = compat_raw_getsockopt,