11
11
12
12
struct bpf_netns_link {
13
13
struct bpf_link link ;
14
- enum bpf_attach_type type ;
15
- enum netns_bpf_attach_type netns_type ;
16
14
17
15
/* We don't hold a ref to net in order to auto-detach the link
18
16
* when netns is going away. Instead we rely on pernet
@@ -21,6 +19,7 @@ struct bpf_netns_link {
21
19
*/
22
20
struct net * net ;
23
21
struct list_head node ; /* node in list of links attached to net */
22
+ enum netns_bpf_attach_type netns_type ;
24
23
};
25
24
26
25
/* Protects updates to netns_bpf */
@@ -216,7 +215,7 @@ static int bpf_netns_link_fill_info(const struct bpf_link *link,
216
215
mutex_unlock (& netns_bpf_mutex );
217
216
218
217
info -> netns .netns_ino = inum ;
219
- info -> netns .attach_type = net_link -> type ;
218
+ info -> netns .attach_type = link -> attach_type ;
220
219
return 0 ;
221
220
}
222
221
@@ -230,7 +229,7 @@ static void bpf_netns_link_show_fdinfo(const struct bpf_link *link,
230
229
"netns_ino:\t%u\n"
231
230
"attach_type:\t%u\n" ,
232
231
info .netns .netns_ino ,
233
- info . netns . attach_type );
232
+ link -> attach_type );
234
233
}
235
234
236
235
static const struct bpf_link_ops bpf_netns_link_ops = {
@@ -503,7 +502,6 @@ int netns_bpf_link_create(const union bpf_attr *attr, struct bpf_prog *prog)
503
502
bpf_link_init (& net_link -> link , BPF_LINK_TYPE_NETNS ,
504
503
& bpf_netns_link_ops , prog , type );
505
504
net_link -> net = net ;
506
- net_link -> type = type ;
507
505
net_link -> netns_type = netns_type ;
508
506
509
507
err = bpf_link_prime (& net_link -> link , & link_primer );
0 commit comments