Lines Matching defs:secattr
3761 * @secattr: the NetLabel packet security attributes
3766 * @skb, in the NetLabel subsystem cache. This function assumes @secattr has
3770 static void security_netlbl_cache_add(struct netlbl_lsm_secattr *secattr,
3778 secattr->cache = netlbl_secattr_cache_alloc(GFP_ATOMIC);
3779 if (secattr->cache == NULL) {
3785 secattr->cache->free = kfree;
3786 secattr->cache->data = sid_cache;
3787 secattr->flags |= NETLBL_SECATTR_CACHE;
3791 * security_netlbl_secattr_to_sid - Convert a NetLabel secattr to a SELinux SID
3792 * @secattr: the NetLabel packet security attributes
3796 * Convert the given NetLabel security attributes in @secattr into a
3797 * SELinux SID. If the @secattr field does not contain a full SELinux
3799 * 'cache' field of @secattr is set and the CACHE flag is set; this is to
3800 * allow the @secattr to be used by NetLabel to cache the secattr to SID
3805 int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
3827 if (secattr->flags & NETLBL_SECATTR_CACHE)
3828 *sid = *(u32 *)secattr->cache->data;
3829 else if (secattr->flags & NETLBL_SECATTR_SECID)
3830 *sid = secattr->attr.secid;
3831 else if (secattr->flags & NETLBL_SECATTR_MLS_LVL) {
3841 mls_import_netlbl_lvl(policydb, &ctx_new, secattr);
3842 if (secattr->flags & NETLBL_SECATTR_MLS_CAT) {
3843 rc = mls_import_netlbl_cat(policydb, &ctx_new, secattr);
3862 security_netlbl_cache_add(secattr, *sid);
3872 * security_netlbl_sid_to_secattr - Convert a SELinux SID to a NetLabel secattr
3874 * @secattr: the NetLabel packet security attributes
3881 int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
3901 secattr->domain = kstrdup(sym_name(policydb, SYM_TYPES, ctx->type - 1),
3903 if (secattr->domain == NULL)
3906 secattr->attr.secid = sid;
3907 secattr->flags |= NETLBL_SECATTR_DOMAIN_CPY | NETLBL_SECATTR_SECID;
3908 mls_export_netlbl_lvl(policydb, ctx, secattr);
3909 rc = mls_export_netlbl_cat(policydb, ctx, secattr);