Lines Matching +full:valid +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0-or-later
10 * Author: Paul Moore <paul@paul-moore.com>
14 * (c) Copyright Hewlett-Packard Development Company, L.P., 2008
36 * netlbl_af4list_search - Search for a matching IPv4 address entry
52 if (iter->valid && (addr & iter->mask) == iter->addr) in netlbl_af4list_search()
59 * netlbl_af4list_search_exact - Search for an exact IPv4 address entry
61 * @mask: IPv4 address mask
71 __be32 mask, in netlbl_af4list_search_exact() argument
77 if (iter->valid && iter->addr == addr && iter->mask == mask) in netlbl_af4list_search_exact()
86 * netlbl_af6list_search - Search for a matching IPv6 address entry
102 if (iter->valid && in netlbl_af6list_search()
103 ipv6_masked_addr_cmp(&iter->addr, &iter->mask, addr) == 0) in netlbl_af6list_search()
110 * netlbl_af6list_search_exact - Search for an exact IPv6 address entry
112 * @mask: IPv6 address mask
122 const struct in6_addr *mask, in netlbl_af6list_search_exact() argument
128 if (iter->valid && in netlbl_af6list_search_exact()
129 ipv6_addr_equal(&iter->addr, addr) && in netlbl_af6list_search_exact()
130 ipv6_addr_equal(&iter->mask, mask)) in netlbl_af6list_search_exact()
138 * netlbl_af4list_add - Add a new IPv4 address entry to a list
152 iter = netlbl_af4list_search(entry->addr, head); in netlbl_af4list_add()
154 iter->addr == entry->addr && iter->mask == entry->mask) in netlbl_af4list_add()
155 return -EEXIST; in netlbl_af4list_add()
159 * address mask such that the entry with the widest mask (smallest in netlbl_af4list_add()
162 if (iter->valid && in netlbl_af4list_add()
163 ntohl(entry->mask) > ntohl(iter->mask)) { in netlbl_af4list_add()
164 __list_add_rcu(&entry->list, in netlbl_af4list_add()
165 iter->list.prev, in netlbl_af4list_add()
166 &iter->list); in netlbl_af4list_add()
169 list_add_tail_rcu(&entry->list, head); in netlbl_af4list_add()
175 * netlbl_af6list_add - Add a new IPv6 address entry to a list
189 iter = netlbl_af6list_search(&entry->addr, head); in netlbl_af6list_add()
191 ipv6_addr_equal(&iter->addr, &entry->addr) && in netlbl_af6list_add()
192 ipv6_addr_equal(&iter->mask, &entry->mask)) in netlbl_af6list_add()
193 return -EEXIST; in netlbl_af6list_add()
197 * address mask such that the entry with the widest mask (smallest in netlbl_af6list_add()
200 if (iter->valid && in netlbl_af6list_add()
201 ipv6_addr_cmp(&entry->mask, &iter->mask) > 0) { in netlbl_af6list_add()
202 __list_add_rcu(&entry->list, in netlbl_af6list_add()
203 iter->list.prev, in netlbl_af6list_add()
204 &iter->list); in netlbl_af6list_add()
207 list_add_tail_rcu(&entry->list, head); in netlbl_af6list_add()
213 * netlbl_af4list_remove_entry - Remove an IPv4 address entry
223 entry->valid = 0; in netlbl_af4list_remove_entry()
224 list_del_rcu(&entry->list); in netlbl_af4list_remove_entry()
228 * netlbl_af4list_remove - Remove an IPv4 address entry
230 * @mask: IP address mask
239 struct netlbl_af4list *netlbl_af4list_remove(__be32 addr, __be32 mask, in netlbl_af4list_remove() argument
244 entry = netlbl_af4list_search_exact(addr, mask, head); in netlbl_af4list_remove()
253 * netlbl_af6list_remove_entry - Remove an IPv6 address entry
263 entry->valid = 0; in netlbl_af6list_remove_entry()
264 list_del_rcu(&entry->list); in netlbl_af6list_remove_entry()
268 * netlbl_af6list_remove - Remove an IPv6 address entry
270 * @mask: IP address mask
280 const struct in6_addr *mask, in netlbl_af6list_remove() argument
285 entry = netlbl_af6list_search_exact(addr, mask, head); in netlbl_af6list_remove()
299 * netlbl_af4list_audit_addr - Audit an IPv4 address
304 * @mask: IP address mask
307 * Write the IPv4 address and address mask, if necessary, to @audit_buf.
312 __be32 addr, __be32 mask) in netlbl_af4list_audit_addr() argument
314 u32 mask_val = ntohl(mask); in netlbl_af4list_audit_addr()
332 * netlbl_af6list_audit_addr - Audit an IPv6 address
337 * @mask: IP address mask
340 * Write the IPv6 address and address mask, if necessary, to @audit_buf.
347 const struct in6_addr *mask) in netlbl_af6list_audit_addr() argument
354 if (ntohl(mask->s6_addr32[3]) != 0xffffffff) { in netlbl_af6list_audit_addr()
357 int iter = -1; in netlbl_af6list_audit_addr()
358 while (ntohl(mask->s6_addr32[++iter]) == 0xffffffff) in netlbl_af6list_audit_addr()
360 mask_val = ntohl(mask->s6_addr32[iter]); in netlbl_af6list_audit_addr()