Lines Matching refs:doi_def
382 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def, in cipso_v4_doi_add() argument
391 doi = doi_def->doi; in cipso_v4_doi_add()
392 doi_type = doi_def->type; in cipso_v4_doi_add()
394 if (doi_def->doi == CIPSO_V4_DOI_UNKNOWN) in cipso_v4_doi_add()
397 switch (doi_def->tags[iter]) { in cipso_v4_doi_add()
402 if (doi_def->type != CIPSO_V4_MAP_PASS) in cipso_v4_doi_add()
406 if (doi_def->type != CIPSO_V4_MAP_LOCAL) in cipso_v4_doi_add()
418 refcount_set(&doi_def->refcount, 1); in cipso_v4_doi_add()
421 if (cipso_v4_doi_search(doi_def->doi)) { in cipso_v4_doi_add()
426 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list); in cipso_v4_doi_add()
464 void cipso_v4_doi_free(struct cipso_v4_doi *doi_def) in cipso_v4_doi_free() argument
466 if (!doi_def) in cipso_v4_doi_free()
469 switch (doi_def->type) { in cipso_v4_doi_free()
471 kfree(doi_def->map.std->lvl.cipso); in cipso_v4_doi_free()
472 kfree(doi_def->map.std->lvl.local); in cipso_v4_doi_free()
473 kfree(doi_def->map.std->cat.cipso); in cipso_v4_doi_free()
474 kfree(doi_def->map.std->cat.local); in cipso_v4_doi_free()
475 kfree(doi_def->map.std); in cipso_v4_doi_free()
478 kfree(doi_def); in cipso_v4_doi_free()
493 struct cipso_v4_doi *doi_def; in cipso_v4_doi_free_rcu() local
495 doi_def = container_of(entry, struct cipso_v4_doi, rcu); in cipso_v4_doi_free_rcu()
496 cipso_v4_doi_free(doi_def); in cipso_v4_doi_free_rcu()
513 struct cipso_v4_doi *doi_def; in cipso_v4_doi_remove() local
517 doi_def = cipso_v4_doi_search(doi); in cipso_v4_doi_remove()
518 if (!doi_def) { in cipso_v4_doi_remove()
523 list_del_rcu(&doi_def->list); in cipso_v4_doi_remove()
526 cipso_v4_doi_putdef(doi_def); in cipso_v4_doi_remove()
554 struct cipso_v4_doi *doi_def; in cipso_v4_doi_getdef() local
557 doi_def = cipso_v4_doi_search(doi); in cipso_v4_doi_getdef()
558 if (!doi_def) in cipso_v4_doi_getdef()
560 if (!refcount_inc_not_zero(&doi_def->refcount)) in cipso_v4_doi_getdef()
561 doi_def = NULL; in cipso_v4_doi_getdef()
565 return doi_def; in cipso_v4_doi_getdef()
576 void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def) in cipso_v4_doi_putdef() argument
578 if (!doi_def) in cipso_v4_doi_putdef()
581 if (!refcount_dec_and_test(&doi_def->refcount)) in cipso_v4_doi_putdef()
585 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu); in cipso_v4_doi_putdef()
602 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), in cipso_v4_doi_walk()
642 static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) in cipso_v4_map_lvl_valid() argument
644 switch (doi_def->type) { in cipso_v4_map_lvl_valid()
648 if ((level < doi_def->map.std->lvl.cipso_size) && in cipso_v4_map_lvl_valid()
649 (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)) in cipso_v4_map_lvl_valid()
669 static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def, in cipso_v4_map_lvl_hton() argument
673 switch (doi_def->type) { in cipso_v4_map_lvl_hton()
678 if (host_lvl < doi_def->map.std->lvl.local_size && in cipso_v4_map_lvl_hton()
679 doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) { in cipso_v4_map_lvl_hton()
680 *net_lvl = doi_def->map.std->lvl.local[host_lvl]; in cipso_v4_map_lvl_hton()
701 static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def, in cipso_v4_map_lvl_ntoh() argument
707 switch (doi_def->type) { in cipso_v4_map_lvl_ntoh()
712 map_tbl = doi_def->map.std; in cipso_v4_map_lvl_ntoh()
715 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl]; in cipso_v4_map_lvl_ntoh()
736 static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rbm_valid() argument
745 switch (doi_def->type) { in cipso_v4_map_cat_rbm_valid()
749 cipso_cat_size = doi_def->map.std->cat.cipso_size; in cipso_v4_map_cat_rbm_valid()
750 cipso_array = doi_def->map.std->cat.cipso; in cipso_v4_map_cat_rbm_valid()
784 static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rbm_hton() argument
796 if (doi_def->type == CIPSO_V4_MAP_TRANS) { in cipso_v4_map_cat_rbm_hton()
797 host_cat_size = doi_def->map.std->cat.local_size; in cipso_v4_map_cat_rbm_hton()
798 host_cat_array = doi_def->map.std->cat.local; in cipso_v4_map_cat_rbm_hton()
807 switch (doi_def->type) { in cipso_v4_map_cat_rbm_hton()
845 static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rbm_ntoh() argument
857 if (doi_def->type == CIPSO_V4_MAP_TRANS) { in cipso_v4_map_cat_rbm_ntoh()
858 net_cat_size = doi_def->map.std->cat.cipso_size; in cipso_v4_map_cat_rbm_ntoh()
859 net_cat_array = doi_def->map.std->cat.cipso; in cipso_v4_map_cat_rbm_ntoh()
873 switch (doi_def->type) { in cipso_v4_map_cat_rbm_ntoh()
907 static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_enum_valid() argument
915 if (doi_def->type != CIPSO_V4_MAP_PASS || enumcat_len & 0x01) in cipso_v4_map_cat_enum_valid()
942 static int cipso_v4_map_cat_enum_hton(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_enum_hton() argument
977 static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_enum_ntoh() argument
1008 static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rng_valid() argument
1017 if (doi_def->type != CIPSO_V4_MAP_PASS || rngcat_len & 0x01) in cipso_v4_map_cat_rng_valid()
1050 static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rng_hton() argument
1109 static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def, in cipso_v4_map_cat_rng_ntoh() argument
1151 static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, in cipso_v4_gentag_hdr() argument
1157 put_unaligned_be32(doi_def->doi, &buf[2]); in cipso_v4_gentag_hdr()
1174 static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def, in cipso_v4_gentag_rbm() argument
1186 ret_val = cipso_v4_map_lvl_hton(doi_def, in cipso_v4_gentag_rbm()
1193 ret_val = cipso_v4_map_cat_rbm_hton(doi_def, in cipso_v4_gentag_rbm()
1230 static int cipso_v4_parsetag_rbm(const struct cipso_v4_doi *doi_def, in cipso_v4_parsetag_rbm() argument
1238 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); in cipso_v4_parsetag_rbm()
1245 ret_val = cipso_v4_map_cat_rbm_ntoh(doi_def, in cipso_v4_parsetag_rbm()
1273 static int cipso_v4_gentag_enum(const struct cipso_v4_doi *doi_def, in cipso_v4_gentag_enum() argument
1285 ret_val = cipso_v4_map_lvl_hton(doi_def, in cipso_v4_gentag_enum()
1292 ret_val = cipso_v4_map_cat_enum_hton(doi_def, in cipso_v4_gentag_enum()
1322 static int cipso_v4_parsetag_enum(const struct cipso_v4_doi *doi_def, in cipso_v4_parsetag_enum() argument
1330 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); in cipso_v4_parsetag_enum()
1337 ret_val = cipso_v4_map_cat_enum_ntoh(doi_def, in cipso_v4_parsetag_enum()
1364 static int cipso_v4_gentag_rng(const struct cipso_v4_doi *doi_def, in cipso_v4_gentag_rng() argument
1376 ret_val = cipso_v4_map_lvl_hton(doi_def, in cipso_v4_gentag_rng()
1383 ret_val = cipso_v4_map_cat_rng_hton(doi_def, in cipso_v4_gentag_rng()
1412 static int cipso_v4_parsetag_rng(const struct cipso_v4_doi *doi_def, in cipso_v4_parsetag_rng() argument
1420 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); in cipso_v4_parsetag_rng()
1427 ret_val = cipso_v4_map_cat_rng_ntoh(doi_def, in cipso_v4_parsetag_rng()
1455 static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def, in cipso_v4_gentag_loc() argument
1481 static int cipso_v4_parsetag_loc(const struct cipso_v4_doi *doi_def, in cipso_v4_parsetag_loc() argument
1557 struct cipso_v4_doi *doi_def = NULL; in cipso_v4_validate() local
1568 doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2])); in cipso_v4_validate()
1569 if (!doi_def) { in cipso_v4_validate()
1577 for (tag_iter = 0; doi_def->tags[tag_iter] != tag[0];) in cipso_v4_validate()
1578 if (doi_def->tags[tag_iter] == CIPSO_V4_TAG_INVALID || in cipso_v4_validate()
1609 if (cipso_v4_map_lvl_valid(doi_def, in cipso_v4_validate()
1615 cipso_v4_map_cat_rbm_valid(doi_def, in cipso_v4_validate()
1629 if (cipso_v4_map_lvl_valid(doi_def, in cipso_v4_validate()
1635 cipso_v4_map_cat_enum_valid(doi_def, in cipso_v4_validate()
1648 if (cipso_v4_map_lvl_valid(doi_def, in cipso_v4_validate()
1654 cipso_v4_map_cat_rng_valid(doi_def, in cipso_v4_validate()
1762 const struct cipso_v4_doi *doi_def, in cipso_v4_genopt() argument
1777 switch (doi_def->tags[iter]) { in cipso_v4_genopt()
1779 ret_val = cipso_v4_gentag_rbm(doi_def, in cipso_v4_genopt()
1785 ret_val = cipso_v4_gentag_enum(doi_def, in cipso_v4_genopt()
1791 ret_val = cipso_v4_gentag_rng(doi_def, in cipso_v4_genopt()
1797 ret_val = cipso_v4_gentag_loc(doi_def, in cipso_v4_genopt()
1809 doi_def->tags[iter] != CIPSO_V4_TAG_INVALID); in cipso_v4_genopt()
1812 cipso_v4_gentag_hdr(doi_def, buf, ret_val); in cipso_v4_genopt()
1831 const struct cipso_v4_doi *doi_def, in cipso_v4_sock_setattr() argument
1859 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); in cipso_v4_sock_setattr()
1916 const struct cipso_v4_doi *doi_def, in cipso_v4_req_setattr() argument
1936 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); in cipso_v4_req_setattr()
2089 struct cipso_v4_doi *doi_def; in cipso_v4_getattr() local
2096 doi_def = cipso_v4_doi_search(doi); in cipso_v4_getattr()
2097 if (!doi_def) in cipso_v4_getattr()
2104 ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr); in cipso_v4_getattr()
2107 ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr); in cipso_v4_getattr()
2110 ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr); in cipso_v4_getattr()
2113 ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr); in cipso_v4_getattr()
2164 const struct cipso_v4_doi *doi_def, in cipso_v4_skbuff_setattr() argument
2175 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); in cipso_v4_skbuff_setattr()