H A D | cipso_ipv4.c | 455 * @doi_def: the DOI structure 461 * ensure that the mapping table specified in @doi_def->map meets all of the 466 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def, cipso_v4_doi_add() argument 475 doi = doi_def->doi; cipso_v4_doi_add() 476 doi_type = doi_def->type; cipso_v4_doi_add() 478 if (doi_def->doi == CIPSO_V4_DOI_UNKNOWN) cipso_v4_doi_add() 481 switch (doi_def->tags[iter]) { cipso_v4_doi_add() 486 if (doi_def->type != CIPSO_V4_MAP_PASS) cipso_v4_doi_add() 490 if (doi_def->type != CIPSO_V4_MAP_LOCAL) cipso_v4_doi_add() 502 atomic_set(&doi_def->refcount, 1); cipso_v4_doi_add() 505 if (cipso_v4_doi_search(doi_def->doi)) { cipso_v4_doi_add() 510 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list); cipso_v4_doi_add() 542 * @doi_def: the DOI definition 548 void cipso_v4_doi_free(struct cipso_v4_doi *doi_def) cipso_v4_doi_free() argument 550 if (!doi_def) cipso_v4_doi_free() 553 switch (doi_def->type) { cipso_v4_doi_free() 555 kfree(doi_def->map.std->lvl.cipso); cipso_v4_doi_free() 556 kfree(doi_def->map.std->lvl.local); cipso_v4_doi_free() 557 kfree(doi_def->map.std->cat.cipso); cipso_v4_doi_free() 558 kfree(doi_def->map.std->cat.local); cipso_v4_doi_free() 561 kfree(doi_def); cipso_v4_doi_free() 576 struct cipso_v4_doi *doi_def; cipso_v4_doi_free_rcu() local 578 doi_def = container_of(entry, struct cipso_v4_doi, rcu); cipso_v4_doi_free_rcu() 579 cipso_v4_doi_free(doi_def); cipso_v4_doi_free_rcu() 596 struct cipso_v4_doi *doi_def; cipso_v4_doi_remove() local 600 doi_def = cipso_v4_doi_search(doi); cipso_v4_doi_remove() 601 if (!doi_def) { cipso_v4_doi_remove() 606 if (!atomic_dec_and_test(&doi_def->refcount)) { cipso_v4_doi_remove() 611 list_del_rcu(&doi_def->list); cipso_v4_doi_remove() 615 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu); cipso_v4_doi_remove() 643 struct cipso_v4_doi *doi_def; cipso_v4_doi_getdef() local 646 doi_def = cipso_v4_doi_search(doi); cipso_v4_doi_getdef() 647 if (!doi_def) cipso_v4_doi_getdef() 649 if (!atomic_inc_not_zero(&doi_def->refcount)) cipso_v4_doi_getdef() 650 doi_def = NULL; cipso_v4_doi_getdef() 654 return doi_def; cipso_v4_doi_getdef() 659 * @doi_def: the DOI definition 665 void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def) cipso_v4_doi_putdef() argument 667 if (!doi_def) cipso_v4_doi_putdef() 670 if (!atomic_dec_and_test(&doi_def->refcount)) cipso_v4_doi_putdef() 673 list_del_rcu(&doi_def->list); cipso_v4_doi_putdef() 677 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu); cipso_v4_doi_putdef() 694 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), cipso_v4_doi_walk() 725 * @doi_def: the DOI definition 734 static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) cipso_v4_map_lvl_valid() argument 736 switch (doi_def->type) { cipso_v4_map_lvl_valid() 740 if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL) cipso_v4_map_lvl_valid() 750 * @doi_def: the DOI definition 760 static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def, cipso_v4_map_lvl_hton() argument 764 switch (doi_def->type) { cipso_v4_map_lvl_hton() 769 if (host_lvl < doi_def->map.std->lvl.local_size && cipso_v4_map_lvl_hton() 770 doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) { cipso_v4_map_lvl_hton() 771 *net_lvl = doi_def->map.std->lvl.local[host_lvl]; cipso_v4_map_lvl_hton() 782 * @doi_def: the DOI definition 792 static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def, cipso_v4_map_lvl_ntoh() argument 798 switch (doi_def->type) { cipso_v4_map_lvl_ntoh() 803 map_tbl = doi_def->map.std; cipso_v4_map_lvl_ntoh() 806 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl]; cipso_v4_map_lvl_ntoh() 817 * @doi_def: the DOI definition 827 static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rbm_valid() argument 836 switch (doi_def->type) { cipso_v4_map_cat_rbm_valid() 840 cipso_cat_size = doi_def->map.std->cat.cipso_size; cipso_v4_map_cat_rbm_valid() 841 cipso_array = doi_def->map.std->cat.cipso; cipso_v4_map_cat_rbm_valid() 864 * @doi_def: the DOI definition 875 static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rbm_hton() argument 887 if (doi_def->type == CIPSO_V4_MAP_TRANS) { cipso_v4_map_cat_rbm_hton() 888 host_cat_size = doi_def->map.std->cat.local_size; cipso_v4_map_cat_rbm_hton() 889 host_cat_array = doi_def->map.std->cat.local; cipso_v4_map_cat_rbm_hton() 898 switch (doi_def->type) { cipso_v4_map_cat_rbm_hton() 925 * @doi_def: the DOI definition 936 static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rbm_ntoh() argument 948 if (doi_def->type == CIPSO_V4_MAP_TRANS) { cipso_v4_map_cat_rbm_ntoh() 949 net_cat_size = doi_def->map.std->cat.cipso_size; cipso_v4_map_cat_rbm_ntoh() 950 net_cat_array = doi_def->map.std->cat.cipso; cipso_v4_map_cat_rbm_ntoh() 964 switch (doi_def->type) { cipso_v4_map_cat_rbm_ntoh() 988 * @doi_def: the DOI definition 998 static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_enum_valid() argument 1006 if (doi_def->type != CIPSO_V4_MAP_PASS || enumcat_len & 0x01) cipso_v4_map_cat_enum_valid() 1021 * @doi_def: the DOI definition 1033 static int cipso_v4_map_cat_enum_hton(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_enum_hton() argument 1057 * @doi_def: the DOI definition 1068 static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_enum_ntoh() argument 1089 * @doi_def: the DOI definition 1099 static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rng_valid() argument 1108 if (doi_def->type != CIPSO_V4_MAP_PASS || rngcat_len & 0x01) cipso_v4_map_cat_rng_valid() 1129 * @doi_def: the DOI definition 1141 static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rng_hton() argument 1189 * @doi_def: the DOI definition 1200 static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def, cipso_v4_map_cat_rng_ntoh() argument 1234 * @doi_def: the DOI definition 1242 static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, cipso_v4_gentag_hdr() argument 1248 *(__be32 *)&buf[2] = htonl(doi_def->doi); cipso_v4_gentag_hdr() 1253 * @doi_def: the DOI definition 1265 static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def, cipso_v4_gentag_rbm() argument 1277 ret_val = cipso_v4_map_lvl_hton(doi_def, cipso_v4_gentag_rbm() 1284 ret_val = cipso_v4_map_cat_rbm_hton(doi_def, cipso_v4_gentag_rbm() 1310 * @doi_def: the DOI definition 1320 static int cipso_v4_parsetag_rbm(const struct cipso_v4_doi *doi_def, cipso_v4_parsetag_rbm() argument 1328 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); cipso_v4_parsetag_rbm() 1335 ret_val = cipso_v4_map_cat_rbm_ntoh(doi_def, cipso_v4_parsetag_rbm() 1352 * @doi_def: the DOI definition 1362 static int cipso_v4_gentag_enum(const struct cipso_v4_doi *doi_def, cipso_v4_gentag_enum() argument 1374 ret_val = cipso_v4_map_lvl_hton(doi_def, cipso_v4_gentag_enum() 1381 ret_val = cipso_v4_map_cat_enum_hton(doi_def, cipso_v4_gentag_enum() 1401 * @doi_def: the DOI definition 1411 static int cipso_v4_parsetag_enum(const struct cipso_v4_doi *doi_def, cipso_v4_parsetag_enum() argument 1419 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); cipso_v4_parsetag_enum() 1426 ret_val = cipso_v4_map_cat_enum_ntoh(doi_def, cipso_v4_parsetag_enum() 1443 * @doi_def: the DOI definition 1453 static int cipso_v4_gentag_rng(const struct cipso_v4_doi *doi_def, cipso_v4_gentag_rng() argument 1465 ret_val = cipso_v4_map_lvl_hton(doi_def, cipso_v4_gentag_rng() 1472 ret_val = cipso_v4_map_cat_rng_hton(doi_def, cipso_v4_gentag_rng() 1492 * @doi_def: the DOI definition 1501 static int cipso_v4_parsetag_rng(const struct cipso_v4_doi *doi_def, cipso_v4_parsetag_rng() argument 1509 ret_val = cipso_v4_map_lvl_ntoh(doi_def, tag[3], &level); cipso_v4_parsetag_rng() 1516 ret_val = cipso_v4_map_cat_rng_ntoh(doi_def, cipso_v4_parsetag_rng() 1533 * @doi_def: the DOI definition 1543 static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def, cipso_v4_gentag_loc() argument 1560 * @doi_def: the DOI definition 1569 static int cipso_v4_parsetag_loc(const struct cipso_v4_doi *doi_def, cipso_v4_parsetag_loc() argument 1633 struct cipso_v4_doi *doi_def = NULL; cipso_v4_validate() local 1644 doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2])); cipso_v4_validate() 1645 if (!doi_def) { cipso_v4_validate() 1653 for (tag_iter = 0; doi_def->tags[tag_iter] != tag[0];) cipso_v4_validate() 1654 if (doi_def->tags[tag_iter] == CIPSO_V4_TAG_INVALID || cipso_v4_validate() 1681 if (cipso_v4_map_lvl_valid(doi_def, cipso_v4_validate() 1687 cipso_v4_map_cat_rbm_valid(doi_def, cipso_v4_validate() 1701 if (cipso_v4_map_lvl_valid(doi_def, cipso_v4_validate() 1707 cipso_v4_map_cat_enum_valid(doi_def, cipso_v4_validate() 1720 if (cipso_v4_map_lvl_valid(doi_def, cipso_v4_validate() 1726 cipso_v4_map_cat_rng_valid(doi_def, cipso_v4_validate() 1806 * @doi_def: the CIPSO DOI to use 1816 const struct cipso_v4_doi *doi_def, cipso_v4_genopt() 1831 switch (doi_def->tags[iter]) { cipso_v4_genopt() 1833 ret_val = cipso_v4_gentag_rbm(doi_def, cipso_v4_genopt() 1839 ret_val = cipso_v4_gentag_enum(doi_def, cipso_v4_genopt() 1845 ret_val = cipso_v4_gentag_rng(doi_def, cipso_v4_genopt() 1851 ret_val = cipso_v4_gentag_loc(doi_def, cipso_v4_genopt() 1863 doi_def->tags[iter] != CIPSO_V4_TAG_INVALID); cipso_v4_genopt() 1866 cipso_v4_gentag_hdr(doi_def, buf, ret_val); cipso_v4_genopt() 1873 * @doi_def: the CIPSO DOI to use 1885 const struct cipso_v4_doi *doi_def, cipso_v4_sock_setattr() 1913 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); cipso_v4_sock_setattr() 1959 * @doi_def: the CIPSO DOI to use 1969 const struct cipso_v4_doi *doi_def, cipso_v4_req_setattr() 1989 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); cipso_v4_req_setattr() 2152 struct cipso_v4_doi *doi_def; cipso_v4_getattr() local 2159 doi_def = cipso_v4_doi_search(doi); cipso_v4_getattr() 2160 if (!doi_def) cipso_v4_getattr() 2167 ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr); cipso_v4_getattr() 2170 ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr); cipso_v4_getattr() 2173 ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr); cipso_v4_getattr() 2176 ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr); cipso_v4_getattr() 2226 const struct cipso_v4_doi *doi_def, cipso_v4_skbuff_setattr() 2237 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); cipso_v4_skbuff_setattr() 693 cipso_v4_doi_walk(u32 *skip_cnt, int (*callback) (struct cipso_v4_doi *doi_def, void *arg), void *cb_arg) cipso_v4_doi_walk() argument 1815 cipso_v4_genopt(unsigned char *buf, u32 buf_len, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) cipso_v4_genopt() argument 1884 cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) cipso_v4_sock_setattr() argument 1968 cipso_v4_req_setattr(struct request_sock *req, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) cipso_v4_req_setattr() argument 2225 cipso_v4_skbuff_setattr(struct sk_buff *skb, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) cipso_v4_skbuff_setattr() argument
|