File tree Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -39,27 +39,9 @@ int landlock_append_net_rule(struct landlock_ruleset *const ruleset,
39
39
return err ;
40
40
}
41
41
42
- static access_mask_t
43
- get_raw_handled_net_accesses (const struct landlock_ruleset * const domain )
44
- {
45
- access_mask_t access_dom = 0 ;
46
- size_t layer_level ;
47
-
48
- for (layer_level = 0 ; layer_level < domain -> num_layers ; layer_level ++ )
49
- access_dom |= landlock_get_net_access_mask (domain , layer_level );
50
- return access_dom ;
51
- }
52
-
53
- static const struct landlock_ruleset * get_current_net_domain (void )
54
- {
55
- const struct landlock_ruleset * const dom =
56
- landlock_get_current_domain ();
57
-
58
- if (!dom || !get_raw_handled_net_accesses (dom ))
59
- return NULL ;
60
-
61
- return dom ;
62
- }
42
+ static const struct access_masks any_net = {
43
+ .net = ~0 ,
44
+ };
63
45
64
46
static int current_check_access_socket (struct socket * const sock ,
65
47
struct sockaddr * const address ,
@@ -72,7 +54,9 @@ static int current_check_access_socket(struct socket *const sock,
72
54
struct landlock_id id = {
73
55
.type = LANDLOCK_KEY_NET_PORT ,
74
56
};
75
- const struct landlock_ruleset * const dom = get_current_net_domain ();
57
+ const struct landlock_ruleset * const dom =
58
+ landlock_get_applicable_domain (landlock_get_current_domain (),
59
+ any_net );
76
60
77
61
if (!dom )
78
62
return 0 ;
You can’t perform that action at this time.
0 commit comments