summaryrefslogtreecommitdiff
path: root/patches/0068-proto-hash/ieee802154.patch
blob: e60ba564543405902d78a597089bbc76244b9aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index e0bd013..9e78921 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -182,14 +182,20 @@ static int ieee802154_sock_ioctl(struct
 static HLIST_HEAD(raw_head);
 static DEFINE_RWLOCK(raw_lock);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
 static int raw_hash(struct sock *sk)
+#else
+static void raw_hash(struct sock *sk)
+#endif
 {
 	write_lock_bh(&raw_lock);
 	sk_add_node(sk, &raw_head);
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
 	write_unlock_bh(&raw_lock);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
 	return 0;
+#endif
 }
 
 static void raw_unhash(struct sock *sk)
@@ -464,14 +470,20 @@ static inline struct dgram_sock *dgram_s
 	return container_of(sk, struct dgram_sock, sk);
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
 static int dgram_hash(struct sock *sk)
+#else
+static void dgram_hash(struct sock *sk)
+#endif
 {
 	write_lock_bh(&dgram_lock);
 	sk_add_node(sk, &dgram_head);
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
 	write_unlock_bh(&dgram_lock);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
 	return 0;
+#endif
 }
 
 static void dgram_unhash(struct sock *sk)
@@ -1031,11 +1043,15 @@ static int ieee802154_create(struct net
 	sock_set_flag(sk, SOCK_ZAPPED);
 
 	if (sk->sk_prot->hash) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
 		rc = sk->sk_prot->hash(sk);
 		if (rc) {
 			sk_common_release(sk);
 			goto out;
 		}
+#else
+		sk->sk_prot->hash(sk);
+#endif
 	}
 
 	if (sk->sk_prot->init) {