Lines Matching refs:cidr

24 				 u8 cidr, u8 bits)  in copy_and_assign_cidr()  argument
26 node->cidr = cidr; in copy_and_assign_cidr()
27 node->bit_at_a = cidr / 8U; in copy_and_assign_cidr()
31 node->bit_at_b = 7U - (cidr % 8U); in copy_and_assign_cidr()
108 return common_bits(node, key, bits) >= node->cidr; in prefix_matches()
119 if (node->cidr == bits) in find_node()
150 u8 cidr, u8 bits, struct allowedips_node **rnode, in node_placement() argument
157 while (node && node->cidr <= cidr && prefix_matches(node, key, bits)) { in node_placement()
159 if (parent->cidr == cidr) { in node_placement()
182 u8 cidr, struct wg_peer *peer, struct mutex *lock) in add() argument
186 if (unlikely(cidr > bits || !peer)) in add()
195 copy_and_assign_cidr(node, key, cidr, bits); in add()
199 if (node_placement(*trie, key, cidr, bits, &node, lock)) { in add()
210 copy_and_assign_cidr(newnode, key, cidr, bits); in add()
222 cidr = min(cidr, common_bits(down, key, bits)); in add()
225 if (newnode->cidr == cidr) { in add()
241 copy_and_assign_cidr(node, newnode->bits, cidr, bits); in add()
282 u8 cidr, struct wg_peer *peer, struct mutex *lock) in wg_allowedips_insert_v4() argument
289 return add(&table->root4, 32, key, cidr, peer, lock); in wg_allowedips_insert_v4()
293 u8 cidr, struct wg_peer *peer, struct mutex *lock) in wg_allowedips_insert_v6() argument
300 return add(&table->root6, 128, key, cidr, peer, lock); in wg_allowedips_insert_v6()
343 int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr) in wg_allowedips_read_node() argument
345 const unsigned int cidr_bytes = DIV_ROUND_UP(node->cidr, 8U); in wg_allowedips_read_node()
348 if (node->cidr) in wg_allowedips_read_node()
349 ip[cidr_bytes - 1U] &= ~0U << (-node->cidr % 8U); in wg_allowedips_read_node()
351 *cidr = node->cidr; in wg_allowedips_read_node()