Lines Matching refs:ad

54 static void set_ad_create(struct apparmor_audit_data *ad,  in set_ad_create()  argument
57 ad->common.u.net->family = family; in set_ad_create()
58 ad->net.type = type; in set_ad_create()
59 ad->net.protocol = protocol; in set_ad_create()
62 static int set_ad_addr(struct apparmor_audit_data *ad, in set_ad_addr() argument
65 ad->common.u.net->family = family; in set_ad_addr()
68 ad->common.u.net->sport = maddr->port; in set_ad_addr()
72 ad->common.u.net->v4info.saddr = *(__be32 *)maddr->addrp; in set_ad_addr()
75 ad->common.u.net->v6info.saddr = *(struct in6_addr *)maddr->addrp; in set_ad_addr()
78 ad->common.u.net->dport = maddr->port; in set_ad_addr()
82 ad->common.u.net->v4info.daddr = *(__be32 *)maddr->addrp; in set_ad_addr()
85 ad->common.u.net->v6info.daddr = *(struct in6_addr *)maddr->addrp; in set_ad_addr()
95 struct apparmor_audit_data *ad) in map_addr() argument
139 if (ad) in map_addr()
140 set_ad_addr(ad, addr->sa_family, addrtype != ADDR_REMOTE, maddr); in map_addr()
148 struct apparmor_audit_data *ad) in map_sock_addr() argument
154 return map_addr(NULL, 0, 0, addrtype, &maddr->maddr, ad); in map_sock_addr()
158 &maddr->maddr, ad); in map_sock_addr()
166 struct apparmor_audit_data *ad) in bind_map_addr() argument
223 if (ad) in bind_map_addr()
224 set_ad_addr(ad, family, true, maddr); in bind_map_addr()
233 struct apparmor_audit_data *ad) in profile_sk_perm() argument
238 return aa_profile_af_sk_perm(profile, ad, request, sk); in profile_sk_perm()
244 struct apparmor_audit_data *ad) in profile_create_perm() argument
248 return aa_profile_af_perm(profile, ad, AA_MAY_CREATE, family, type, in profile_create_perm()
258 struct apparmor_audit_data *ad) in profile_remote_perm() argument
267 return aa_profile_af_sk_perm(profile, ad, request, sk); in profile_remote_perm()
273 struct apparmor_audit_data *ad) in profile_bind_perm() argument
275 return aa_profile_af_sk_perm(profile, ad, AA_MAY_BIND, sk); in profile_bind_perm()
282 struct apparmor_audit_data *ad) in profile_listen_perm() argument
290 return aa_profile_af_sk_perm(profile, ad, AA_MAY_LISTEN, sk); in profile_listen_perm()
297 struct apparmor_audit_data *ad) in profile_accept_perm() argument
306 return aa_profile_af_sk_perm(profile, ad, AA_MAY_ACCEPT, sk); in profile_accept_perm()
313 struct apparmor_audit_data *ad) in profile_opt_perm() argument
321 return aa_profile_af_sk_perm(profile, ad, request, sk); in profile_opt_perm()
395 DEFINE_AUDIT_NET(ad, OP_CREATE, current_cred(), NULL, family, type, in aa_inet_create_perm()
398 ad.subj_cred = current_cred(); in aa_inet_create_perm()
399 set_ad_create(&ad, family, type, protocol); in aa_inet_create_perm()
402 protocol, &ad)); in aa_inet_create_perm()
412 return sk_has_perm1(sock->sk, OP_BIND, AA_MAY_BIND, profile, ad, in aa_inet_bind_perm()
414 &ad), in aa_inet_bind_perm()
415 profile_bind_perm(profile, sock->sk, &maddr, &ad)); in aa_inet_bind_perm()
431 return sk_has_perm2(sock->sk, OP_CONNECT, AA_MAY_CONNECT, profile, ad, in aa_inet_connect_perm()
432 map_sock_addr(sock, ADDR_LOCAL, &laddr, &ad), in aa_inet_connect_perm()
434 &ad), in aa_inet_connect_perm()
437 &laddr.maddr, &ad)); in aa_inet_connect_perm()
445 return sk_has_perm1(sock->sk, OP_LISTEN, AA_MAY_LISTEN, profile, ad, in aa_inet_listen_perm()
446 map_sock_addr(sock, ADDR_LOCAL, &maddr, &ad), in aa_inet_listen_perm()
448 backlog, &ad)); in aa_inet_listen_perm()
457 error = sk_has_perm1(sock->sk, OP_ACCEPT, AA_MAY_ACCEPT, profile, ad, in aa_inet_accept_perm()
458 map_sock_addr(sock, ADDR_LOCAL, &maddr, &ad), in aa_inet_accept_perm()
461 newsock->sk, &ad)); in aa_inet_accept_perm()
475 return sk_has_perm2(sock->sk, op, request, profile, ad, in aa_inet_msg_perm()
476 map_sock_addr(sock, ADDR_LOCAL, &laddr, &ad), in aa_inet_msg_perm()
478 ADDR_REMOTE, &raddr, &ad), in aa_inet_msg_perm()
480 &raddr, &laddr.maddr, &ad)); in aa_inet_msg_perm()
489 return sk_has_perm1(sock->sk, op, request, profile, ad, in aa_inet_opt_perm()
490 map_sock_addr(sock, ADDR_LOCAL, &maddr, &ad), in aa_inet_opt_perm()
492 &maddr.maddr, level, optname, &ad)); in aa_inet_opt_perm()
502 ad, in inet_label_sock_perm()
503 map_sock_addr(sock, ADDR_LOCAL, &maddr, &ad), in inet_label_sock_perm()
505 &maddr.maddr, &ad)); in inet_label_sock_perm()
542 profile, ad, in aa_inet_file_perm()
543 map_sock_addr(sock, ADDR_LOCAL, &laddr, &ad), in aa_inet_file_perm()
545 &ad)); in aa_inet_file_perm()
554 op, request, profile, ad, in aa_inet_file_perm()
555 set_ad_addr(&ad, raddr.addr.sa_family, in aa_inet_file_perm()
560 &laddr.maddr, &ad)); in aa_inet_file_perm()