2 * NetLabel Domain Hash Table
4 * This file manages the domain hash table that NetLabel uses to determine
5 * which network labeling protocol to use for a given domain. The NetLabel
6 * system manages static and dynamic label mappings for network protocols such
9 * Author: Paul Moore <paul@paul-moore.com>
14 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
24 * the GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see <http://www.gnu.org/licenses/>.
31 #include <linux/types.h>
32 #include <linux/rculist.h>
33 #include <linux/skbuff.h>
34 #include <linux/spinlock.h>
35 #include <linux/string.h>
36 #include <linux/audit.h>
37 #include <linux/slab.h>
38 #include <net/netlabel.h>
39 #include <net/cipso_ipv4.h>
42 #include "netlabel_mgmt.h"
43 #include "netlabel_addrlist.h"
44 #include "netlabel_domainhash.h"
45 #include "netlabel_user.h"
47 struct netlbl_domhsh_tbl
{
48 struct list_head
*tbl
;
52 /* Domain hash table */
53 /* updates should be so rare that having one spinlock for the entire hash table
55 static DEFINE_SPINLOCK(netlbl_domhsh_lock
);
56 #define netlbl_domhsh_rcu_deref(p) \
57 rcu_dereference_check(p, lockdep_is_held(&netlbl_domhsh_lock))
58 static struct netlbl_domhsh_tbl
*netlbl_domhsh
;
59 static struct netlbl_dom_map
*netlbl_domhsh_def
;
62 * Domain Hash Table Helper Functions
66 * netlbl_domhsh_free_entry - Frees a domain hash table entry
67 * @entry: the entry's RCU field
70 * This function is designed to be used as a callback to the call_rcu()
71 * function so that the memory allocated to a hash table entry can be released
75 static void netlbl_domhsh_free_entry(struct rcu_head
*entry
)
77 struct netlbl_dom_map
*ptr
;
78 struct netlbl_af4list
*iter4
;
79 struct netlbl_af4list
*tmp4
;
80 #if IS_ENABLED(CONFIG_IPV6)
81 struct netlbl_af6list
*iter6
;
82 struct netlbl_af6list
*tmp6
;
85 ptr
= container_of(entry
, struct netlbl_dom_map
, rcu
);
86 if (ptr
->def
.type
== NETLBL_NLTYPE_ADDRSELECT
) {
87 netlbl_af4list_foreach_safe(iter4
, tmp4
,
88 &ptr
->def
.addrsel
->list4
) {
89 netlbl_af4list_remove_entry(iter4
);
90 kfree(netlbl_domhsh_addr4_entry(iter4
));
92 #if IS_ENABLED(CONFIG_IPV6)
93 netlbl_af6list_foreach_safe(iter6
, tmp6
,
94 &ptr
->def
.addrsel
->list6
) {
95 netlbl_af6list_remove_entry(iter6
);
96 kfree(netlbl_domhsh_addr6_entry(iter6
));
105 * netlbl_domhsh_hash - Hashing function for the domain hash table
106 * @domain: the domain name to hash
109 * This is the hashing function for the domain hash table, it returns the
110 * correct bucket number for the domain. The caller is responsible for
111 * ensuring that the hash table is protected with either a RCU read lock or the
115 static u32
netlbl_domhsh_hash(const char *key
)
121 /* This is taken (with slight modification) from
122 * security/selinux/ss/symtab.c:symhash() */
124 for (iter
= 0, val
= 0, len
= strlen(key
); iter
< len
; iter
++)
125 val
= (val
<< 4 | (val
>> (8 * sizeof(u32
) - 4))) ^ key
[iter
];
126 return val
& (netlbl_domhsh_rcu_deref(netlbl_domhsh
)->size
- 1);
130 * netlbl_domhsh_search - Search for a domain entry
131 * @domain: the domain
134 * Searches the domain hash table and returns a pointer to the hash table
135 * entry if found, otherwise NULL is returned. The caller is responsible for
136 * ensuring that the hash table is protected with either a RCU read lock or the
140 static struct netlbl_dom_map
*netlbl_domhsh_search(const char *domain
)
143 struct list_head
*bkt_list
;
144 struct netlbl_dom_map
*iter
;
146 if (domain
!= NULL
) {
147 bkt
= netlbl_domhsh_hash(domain
);
148 bkt_list
= &netlbl_domhsh_rcu_deref(netlbl_domhsh
)->tbl
[bkt
];
149 list_for_each_entry_rcu(iter
, bkt_list
, list
)
150 if (iter
->valid
&& strcmp(iter
->domain
, domain
) == 0)
158 * netlbl_domhsh_search_def - Search for a domain entry
159 * @domain: the domain
160 * @def: return default if no match is found
163 * Searches the domain hash table and returns a pointer to the hash table
164 * entry if an exact match is found, if an exact match is not present in the
165 * hash table then the default entry is returned if valid otherwise NULL is
166 * returned. The caller is responsible ensuring that the hash table is
167 * protected with either a RCU read lock or the hash table lock.
170 static struct netlbl_dom_map
*netlbl_domhsh_search_def(const char *domain
)
172 struct netlbl_dom_map
*entry
;
174 entry
= netlbl_domhsh_search(domain
);
176 entry
= netlbl_domhsh_rcu_deref(netlbl_domhsh_def
);
177 if (entry
!= NULL
&& !entry
->valid
)
185 * netlbl_domhsh_audit_add - Generate an audit entry for an add event
186 * @entry: the entry being added
187 * @addr4: the IPv4 address information
188 * @addr6: the IPv6 address information
189 * @result: the result code
190 * @audit_info: NetLabel audit information
193 * Generate an audit record for adding a new NetLabel/LSM mapping entry with
194 * the given information. Caller is responsible for holding the necessary
198 static void netlbl_domhsh_audit_add(struct netlbl_dom_map
*entry
,
199 struct netlbl_af4list
*addr4
,
200 struct netlbl_af6list
*addr6
,
202 struct netlbl_audit
*audit_info
)
204 struct audit_buffer
*audit_buf
;
205 struct cipso_v4_doi
*cipsov4
= NULL
;
208 audit_buf
= netlbl_audit_start_common(AUDIT_MAC_MAP_ADD
, audit_info
);
209 if (audit_buf
!= NULL
) {
210 audit_log_format(audit_buf
, " nlbl_domain=%s",
211 entry
->domain
? entry
->domain
: "(default)");
213 struct netlbl_domaddr4_map
*map4
;
214 map4
= netlbl_domhsh_addr4_entry(addr4
);
215 type
= map4
->def
.type
;
216 cipsov4
= map4
->def
.cipso
;
217 netlbl_af4list_audit_addr(audit_buf
, 0, NULL
,
218 addr4
->addr
, addr4
->mask
);
219 #if IS_ENABLED(CONFIG_IPV6)
220 } else if (addr6
!= NULL
) {
221 struct netlbl_domaddr6_map
*map6
;
222 map6
= netlbl_domhsh_addr6_entry(addr6
);
223 type
= map6
->def
.type
;
224 netlbl_af6list_audit_addr(audit_buf
, 0, NULL
,
225 &addr6
->addr
, &addr6
->mask
);
228 type
= entry
->def
.type
;
229 cipsov4
= entry
->def
.cipso
;
232 case NETLBL_NLTYPE_UNLABELED
:
233 audit_log_format(audit_buf
, " nlbl_protocol=unlbl");
235 case NETLBL_NLTYPE_CIPSOV4
:
236 BUG_ON(cipsov4
== NULL
);
237 audit_log_format(audit_buf
,
238 " nlbl_protocol=cipsov4 cipso_doi=%u",
242 audit_log_format(audit_buf
, " res=%u", result
== 0 ? 1 : 0);
243 audit_log_end(audit_buf
);
248 * netlbl_domhsh_validate - Validate a new domain mapping entry
249 * @entry: the entry to validate
251 * This function validates the new domain mapping entry to ensure that it is
252 * a valid entry. Returns zero on success, negative values on failure.
255 static int netlbl_domhsh_validate(const struct netlbl_dom_map
*entry
)
257 struct netlbl_af4list
*iter4
;
258 struct netlbl_domaddr4_map
*map4
;
259 #if IS_ENABLED(CONFIG_IPV6)
260 struct netlbl_af6list
*iter6
;
261 struct netlbl_domaddr6_map
*map6
;
267 switch (entry
->def
.type
) {
268 case NETLBL_NLTYPE_UNLABELED
:
269 if (entry
->def
.cipso
!= NULL
|| entry
->def
.addrsel
!= NULL
)
272 case NETLBL_NLTYPE_CIPSOV4
:
273 if (entry
->def
.cipso
== NULL
)
276 case NETLBL_NLTYPE_ADDRSELECT
:
277 netlbl_af4list_foreach(iter4
, &entry
->def
.addrsel
->list4
) {
278 map4
= netlbl_domhsh_addr4_entry(iter4
);
279 switch (map4
->def
.type
) {
280 case NETLBL_NLTYPE_UNLABELED
:
281 if (map4
->def
.cipso
!= NULL
)
284 case NETLBL_NLTYPE_CIPSOV4
:
285 if (map4
->def
.cipso
== NULL
)
292 #if IS_ENABLED(CONFIG_IPV6)
293 netlbl_af6list_foreach(iter6
, &entry
->def
.addrsel
->list6
) {
294 map6
= netlbl_domhsh_addr6_entry(iter6
);
295 switch (map6
->def
.type
) {
296 case NETLBL_NLTYPE_UNLABELED
:
312 * Domain Hash Table Functions
316 * netlbl_domhsh_init - Init for the domain hash
317 * @size: the number of bits to use for the hash buckets
320 * Initializes the domain hash table, should be called only by
321 * netlbl_user_init() during initialization. Returns zero on success, non-zero
325 int __init
netlbl_domhsh_init(u32 size
)
328 struct netlbl_domhsh_tbl
*hsh_tbl
;
333 hsh_tbl
= kmalloc(sizeof(*hsh_tbl
), GFP_KERNEL
);
336 hsh_tbl
->size
= 1 << size
;
337 hsh_tbl
->tbl
= kcalloc(hsh_tbl
->size
,
338 sizeof(struct list_head
),
340 if (hsh_tbl
->tbl
== NULL
) {
344 for (iter
= 0; iter
< hsh_tbl
->size
; iter
++)
345 INIT_LIST_HEAD(&hsh_tbl
->tbl
[iter
]);
347 spin_lock(&netlbl_domhsh_lock
);
348 rcu_assign_pointer(netlbl_domhsh
, hsh_tbl
);
349 spin_unlock(&netlbl_domhsh_lock
);
355 * netlbl_domhsh_add - Adds a entry to the domain hash table
356 * @entry: the entry to add
357 * @audit_info: NetLabel audit information
360 * Adds a new entry to the domain hash table and handles any updates to the
361 * lower level protocol handler (i.e. CIPSO). Returns zero on success,
362 * negative on failure.
365 int netlbl_domhsh_add(struct netlbl_dom_map
*entry
,
366 struct netlbl_audit
*audit_info
)
369 struct netlbl_dom_map
*entry_old
;
370 struct netlbl_af4list
*iter4
;
371 struct netlbl_af4list
*tmp4
;
372 #if IS_ENABLED(CONFIG_IPV6)
373 struct netlbl_af6list
*iter6
;
374 struct netlbl_af6list
*tmp6
;
377 ret_val
= netlbl_domhsh_validate(entry
);
381 /* XXX - we can remove this RCU read lock as the spinlock protects the
382 * entire function, but before we do we need to fixup the
383 * netlbl_af[4,6]list RCU functions to do "the right thing" with
384 * respect to rcu_dereference() when only a spinlock is held. */
386 spin_lock(&netlbl_domhsh_lock
);
387 if (entry
->domain
!= NULL
)
388 entry_old
= netlbl_domhsh_search(entry
->domain
);
390 entry_old
= netlbl_domhsh_search_def(entry
->domain
);
391 if (entry_old
== NULL
) {
394 if (entry
->domain
!= NULL
) {
395 u32 bkt
= netlbl_domhsh_hash(entry
->domain
);
396 list_add_tail_rcu(&entry
->list
,
397 &rcu_dereference(netlbl_domhsh
)->tbl
[bkt
]);
399 INIT_LIST_HEAD(&entry
->list
);
400 rcu_assign_pointer(netlbl_domhsh_def
, entry
);
403 if (entry
->def
.type
== NETLBL_NLTYPE_ADDRSELECT
) {
404 netlbl_af4list_foreach_rcu(iter4
,
405 &entry
->def
.addrsel
->list4
)
406 netlbl_domhsh_audit_add(entry
, iter4
, NULL
,
407 ret_val
, audit_info
);
408 #if IS_ENABLED(CONFIG_IPV6)
409 netlbl_af6list_foreach_rcu(iter6
,
410 &entry
->def
.addrsel
->list6
)
411 netlbl_domhsh_audit_add(entry
, NULL
, iter6
,
412 ret_val
, audit_info
);
415 netlbl_domhsh_audit_add(entry
, NULL
, NULL
,
416 ret_val
, audit_info
);
417 } else if (entry_old
->def
.type
== NETLBL_NLTYPE_ADDRSELECT
&&
418 entry
->def
.type
== NETLBL_NLTYPE_ADDRSELECT
) {
419 struct list_head
*old_list4
;
420 struct list_head
*old_list6
;
422 old_list4
= &entry_old
->def
.addrsel
->list4
;
423 old_list6
= &entry_old
->def
.addrsel
->list6
;
425 /* we only allow the addition of address selectors if all of
426 * the selectors do not exist in the existing domain map */
427 netlbl_af4list_foreach_rcu(iter4
, &entry
->def
.addrsel
->list4
)
428 if (netlbl_af4list_search_exact(iter4
->addr
,
434 #if IS_ENABLED(CONFIG_IPV6)
435 netlbl_af6list_foreach_rcu(iter6
, &entry
->def
.addrsel
->list6
)
436 if (netlbl_af6list_search_exact(&iter6
->addr
,
444 netlbl_af4list_foreach_safe(iter4
, tmp4
,
445 &entry
->def
.addrsel
->list4
) {
446 netlbl_af4list_remove_entry(iter4
);
448 ret_val
= netlbl_af4list_add(iter4
, old_list4
);
449 netlbl_domhsh_audit_add(entry_old
, iter4
, NULL
,
450 ret_val
, audit_info
);
454 #if IS_ENABLED(CONFIG_IPV6)
455 netlbl_af6list_foreach_safe(iter6
, tmp6
,
456 &entry
->def
.addrsel
->list6
) {
457 netlbl_af6list_remove_entry(iter6
);
459 ret_val
= netlbl_af6list_add(iter6
, old_list6
);
460 netlbl_domhsh_audit_add(entry_old
, NULL
, iter6
,
461 ret_val
, audit_info
);
470 spin_unlock(&netlbl_domhsh_lock
);
476 * netlbl_domhsh_add_default - Adds the default entry to the domain hash table
477 * @entry: the entry to add
478 * @audit_info: NetLabel audit information
481 * Adds a new default entry to the domain hash table and handles any updates
482 * to the lower level protocol handler (i.e. CIPSO). Returns zero on success,
483 * negative on failure.
486 int netlbl_domhsh_add_default(struct netlbl_dom_map
*entry
,
487 struct netlbl_audit
*audit_info
)
489 return netlbl_domhsh_add(entry
, audit_info
);
493 * netlbl_domhsh_remove_entry - Removes a given entry from the domain table
494 * @entry: the entry to remove
495 * @audit_info: NetLabel audit information
498 * Removes an entry from the domain hash table and handles any updates to the
499 * lower level protocol handler (i.e. CIPSO). Caller is responsible for
500 * ensuring that the RCU read lock is held. Returns zero on success, negative
504 int netlbl_domhsh_remove_entry(struct netlbl_dom_map
*entry
,
505 struct netlbl_audit
*audit_info
)
508 struct audit_buffer
*audit_buf
;
513 spin_lock(&netlbl_domhsh_lock
);
516 if (entry
!= rcu_dereference(netlbl_domhsh_def
))
517 list_del_rcu(&entry
->list
);
519 RCU_INIT_POINTER(netlbl_domhsh_def
, NULL
);
522 spin_unlock(&netlbl_domhsh_lock
);
524 audit_buf
= netlbl_audit_start_common(AUDIT_MAC_MAP_DEL
, audit_info
);
525 if (audit_buf
!= NULL
) {
526 audit_log_format(audit_buf
,
527 " nlbl_domain=%s res=%u",
528 entry
->domain
? entry
->domain
: "(default)",
529 ret_val
== 0 ? 1 : 0);
530 audit_log_end(audit_buf
);
534 struct netlbl_af4list
*iter4
;
535 struct netlbl_domaddr4_map
*map4
;
537 switch (entry
->def
.type
) {
538 case NETLBL_NLTYPE_ADDRSELECT
:
539 netlbl_af4list_foreach_rcu(iter4
,
540 &entry
->def
.addrsel
->list4
) {
541 map4
= netlbl_domhsh_addr4_entry(iter4
);
542 cipso_v4_doi_putdef(map4
->def
.cipso
);
544 /* no need to check the IPv6 list since we currently
545 * support only unlabeled protocols for IPv6 */
547 case NETLBL_NLTYPE_CIPSOV4
:
548 cipso_v4_doi_putdef(entry
->def
.cipso
);
551 call_rcu(&entry
->rcu
, netlbl_domhsh_free_entry
);
558 * netlbl_domhsh_remove_af4 - Removes an address selector entry
559 * @domain: the domain
560 * @addr: IPv4 address
561 * @mask: IPv4 address mask
562 * @audit_info: NetLabel audit information
565 * Removes an individual address selector from a domain mapping and potentially
566 * the entire mapping if it is empty. Returns zero on success, negative values
570 int netlbl_domhsh_remove_af4(const char *domain
,
571 const struct in_addr
*addr
,
572 const struct in_addr
*mask
,
573 struct netlbl_audit
*audit_info
)
575 struct netlbl_dom_map
*entry_map
;
576 struct netlbl_af4list
*entry_addr
;
577 struct netlbl_af4list
*iter4
;
578 #if IS_ENABLED(CONFIG_IPV6)
579 struct netlbl_af6list
*iter6
;
581 struct netlbl_domaddr4_map
*entry
;
586 entry_map
= netlbl_domhsh_search(domain
);
588 entry_map
= netlbl_domhsh_search_def(domain
);
589 if (entry_map
== NULL
||
590 entry_map
->def
.type
!= NETLBL_NLTYPE_ADDRSELECT
)
591 goto remove_af4_failure
;
593 spin_lock(&netlbl_domhsh_lock
);
594 entry_addr
= netlbl_af4list_remove(addr
->s_addr
, mask
->s_addr
,
595 &entry_map
->def
.addrsel
->list4
);
596 spin_unlock(&netlbl_domhsh_lock
);
598 if (entry_addr
== NULL
)
599 goto remove_af4_failure
;
600 netlbl_af4list_foreach_rcu(iter4
, &entry_map
->def
.addrsel
->list4
)
601 goto remove_af4_single_addr
;
602 #if IS_ENABLED(CONFIG_IPV6)
603 netlbl_af6list_foreach_rcu(iter6
, &entry_map
->def
.addrsel
->list6
)
604 goto remove_af4_single_addr
;
606 /* the domain mapping is empty so remove it from the mapping table */
607 netlbl_domhsh_remove_entry(entry_map
, audit_info
);
609 remove_af4_single_addr
:
611 /* yick, we can't use call_rcu here because we don't have a rcu head
612 * pointer but hopefully this should be a rare case so the pause
613 * shouldn't be a problem */
615 entry
= netlbl_domhsh_addr4_entry(entry_addr
);
616 cipso_v4_doi_putdef(entry
->def
.cipso
);
626 * netlbl_domhsh_remove - Removes an entry from the domain hash table
627 * @domain: the domain to remove
628 * @audit_info: NetLabel audit information
631 * Removes an entry from the domain hash table and handles any updates to the
632 * lower level protocol handler (i.e. CIPSO). Returns zero on success,
633 * negative on failure.
636 int netlbl_domhsh_remove(const char *domain
, struct netlbl_audit
*audit_info
)
639 struct netlbl_dom_map
*entry
;
643 entry
= netlbl_domhsh_search(domain
);
645 entry
= netlbl_domhsh_search_def(domain
);
646 ret_val
= netlbl_domhsh_remove_entry(entry
, audit_info
);
653 * netlbl_domhsh_remove_default - Removes the default entry from the table
654 * @audit_info: NetLabel audit information
657 * Removes/resets the default entry for the domain hash table and handles any
658 * updates to the lower level protocol handler (i.e. CIPSO). Returns zero on
659 * success, non-zero on failure.
662 int netlbl_domhsh_remove_default(struct netlbl_audit
*audit_info
)
664 return netlbl_domhsh_remove(NULL
, audit_info
);
668 * netlbl_domhsh_getentry - Get an entry from the domain hash table
669 * @domain: the domain name to search for
672 * Look through the domain hash table searching for an entry to match @domain,
673 * return a pointer to a copy of the entry or NULL. The caller is responsible
674 * for ensuring that rcu_read_[un]lock() is called.
677 struct netlbl_dom_map
*netlbl_domhsh_getentry(const char *domain
)
679 return netlbl_domhsh_search_def(domain
);
683 * netlbl_domhsh_getentry_af4 - Get an entry from the domain hash table
684 * @domain: the domain name to search for
685 * @addr: the IP address to search for
688 * Look through the domain hash table searching for an entry to match @domain
689 * and @addr, return a pointer to a copy of the entry or NULL. The caller is
690 * responsible for ensuring that rcu_read_[un]lock() is called.
693 struct netlbl_dommap_def
*netlbl_domhsh_getentry_af4(const char *domain
,
696 struct netlbl_dom_map
*dom_iter
;
697 struct netlbl_af4list
*addr_iter
;
699 dom_iter
= netlbl_domhsh_search_def(domain
);
700 if (dom_iter
== NULL
)
703 if (dom_iter
->def
.type
!= NETLBL_NLTYPE_ADDRSELECT
)
704 return &dom_iter
->def
;
705 addr_iter
= netlbl_af4list_search(addr
, &dom_iter
->def
.addrsel
->list4
);
706 if (addr_iter
== NULL
)
708 return &(netlbl_domhsh_addr4_entry(addr_iter
)->def
);
711 #if IS_ENABLED(CONFIG_IPV6)
713 * netlbl_domhsh_getentry_af6 - Get an entry from the domain hash table
714 * @domain: the domain name to search for
715 * @addr: the IP address to search for
718 * Look through the domain hash table searching for an entry to match @domain
719 * and @addr, return a pointer to a copy of the entry or NULL. The caller is
720 * responsible for ensuring that rcu_read_[un]lock() is called.
723 struct netlbl_dommap_def
*netlbl_domhsh_getentry_af6(const char *domain
,
724 const struct in6_addr
*addr
)
726 struct netlbl_dom_map
*dom_iter
;
727 struct netlbl_af6list
*addr_iter
;
729 dom_iter
= netlbl_domhsh_search_def(domain
);
730 if (dom_iter
== NULL
)
733 if (dom_iter
->def
.type
!= NETLBL_NLTYPE_ADDRSELECT
)
734 return &dom_iter
->def
;
735 addr_iter
= netlbl_af6list_search(addr
, &dom_iter
->def
.addrsel
->list6
);
736 if (addr_iter
== NULL
)
738 return &(netlbl_domhsh_addr6_entry(addr_iter
)->def
);
743 * netlbl_domhsh_walk - Iterate through the domain mapping hash table
744 * @skip_bkt: the number of buckets to skip at the start
745 * @skip_chain: the number of entries to skip in the first iterated bucket
746 * @callback: callback for each entry
747 * @cb_arg: argument for the callback function
750 * Interate over the domain mapping hash table, skipping the first @skip_bkt
751 * buckets and @skip_chain entries. For each entry in the table call
752 * @callback, if @callback returns a negative value stop 'walking' through the
753 * table and return. Updates the values in @skip_bkt and @skip_chain on
754 * return. Returns zero on success, negative values on failure.
757 int netlbl_domhsh_walk(u32
*skip_bkt
,
759 int (*callback
) (struct netlbl_dom_map
*entry
, void *arg
),
762 int ret_val
= -ENOENT
;
764 struct list_head
*iter_list
;
765 struct netlbl_dom_map
*iter_entry
;
769 for (iter_bkt
= *skip_bkt
;
770 iter_bkt
< rcu_dereference(netlbl_domhsh
)->size
;
771 iter_bkt
++, chain_cnt
= 0) {
772 iter_list
= &rcu_dereference(netlbl_domhsh
)->tbl
[iter_bkt
];
773 list_for_each_entry_rcu(iter_entry
, iter_list
, list
)
774 if (iter_entry
->valid
) {
775 if (chain_cnt
++ < *skip_chain
)
777 ret_val
= callback(iter_entry
, cb_arg
);
787 *skip_bkt
= iter_bkt
;
788 *skip_chain
= chain_cnt
;