summaryrefslogtreecommitdiff
path: root/patches/collateral-evolutions/network/0044-no_user_ns_in_net/ieee802154.patch
blob: d5f951b98ff0b699a6f49797c6d8eff09f5e7287 (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
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -483,8 +483,13 @@ static int dgram_setsockopt(struct sock
 		ro->want_ack = !!val;
 		break;
 	case WPAN_SECURITY:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
 		    !ns_capable(net->user_ns, CAP_NET_RAW)) {
+#else
+		if (!capable(CAP_NET_ADMIN) &&
+		    !capable(CAP_NET_RAW)) {
+#endif
 			err = -EPERM;
 			break;
 		}
@@ -507,8 +512,13 @@ static int dgram_setsockopt(struct sock
 		}
 		break;
 	case WPAN_SECURITY_LEVEL:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
 		    !ns_capable(net->user_ns, CAP_NET_RAW)) {
+#else
+		if (!capable(CAP_NET_ADMIN) &&
+		    !capable(CAP_NET_RAW)) {
+#endif
 			err = -EPERM;
 			break;
 		}