Lines Matching +full:x +full:- +full:mask +full:-

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
48 #define log(x, arg...) fprintf(stderr, ## arg) argument
49 #define panic(x) fprintf(stderr, "PANIC: %s", x), exit(1) argument
68 -1, -1, -1, -1, -1, -1, -1, -1,
69 -1, -1, -1, -1, -1, -1, -1, -1,
70 -1, -1, -1, -1, -1, -1, -1, -1,
71 -1, -1, -1, -1, -1, -1, -1, -1,
85 * of a node n have keys whose bits all agree up to position rn_bit - 1.
91 * A route is determined by a pair of key and mask. We require that the
92 * bit-wise logical and of the key and mask to be the key.
93 * We define the index of a route to associated with the mask to be
94 * the first bit number in the mask where 0 occurs (with bit number 0
97 * We say a mask is normal if every bit is 0, past the index of the mask.
99 * and m is a normal mask, then the route applies to every descendant of n.
104 * Similar logic shows that a non-normal mask m such that
106 * Thus, for each non-host route, we attach its mask to a list at an internal
109 * The present version of the code makes use of normal routes in short-
110 * circuiting an explict mask and compare operation when testing whether
116 * Most of the functions in this code assume that the key/mask arguments
117 * are sockaddr-like structures, where the first byte is an u_char
125 #define LEN(x) ( (int) (*(const u_char *)(x)) ) argument
144 struct radix_node *x; in rn_search() local
147 for (x = head, v = v_arg; x->rn_bit >= 0;) { in rn_search()
148 if (x->rn_bmask & v[x->rn_offset]) in rn_search()
149 x = x->rn_right; in rn_search()
151 x = x->rn_left; in rn_search()
153 return (x); in rn_search()
157 * Same as above, but with an additional mask.
163 struct radix_node *x; in rn_search_m() local
166 for (x = head; x->rn_bit >= 0;) { in rn_search_m()
167 if ((x->rn_bmask & m[x->rn_offset]) && in rn_search_m()
168 (x->rn_bmask & v[x->rn_offset])) in rn_search_m()
169 x = x->rn_right; in rn_search_m()
171 x = x->rn_left; in rn_search_m()
173 return (x); in rn_search_m()
181 int longer = LEN(n++) - LEN(m++); in rn_refines()
185 lim -= longer; in rn_refines()
196 for (lim2 = m - longer; m < lim2; ) in rn_refines()
211 struct radix_node *x; in rn_lookup() local
216 * Most common case: search exact prefix/mask in rn_lookup()
218 x = rn_addmask(m_arg, head->rnh_masks, 1, in rn_lookup()
219 head->rnh_treetop->rn_offset); in rn_lookup()
220 if (x == NULL) in rn_lookup()
222 netmask = x->rn_key; in rn_lookup()
224 x = rn_match(v_arg, head); in rn_lookup()
226 while (x != NULL && x->rn_mask != netmask) in rn_lookup()
227 x = x->rn_dupedkey; in rn_lookup()
229 return (x); in rn_lookup()
235 if ((x = rn_match(v_arg, head)) == NULL) in rn_lookup()
239 if (LEN(x->rn_key) != LEN(v_arg) || bcmp(x->rn_key, v_arg, LEN(v_arg))) in rn_lookup()
243 if (x->rn_mask != NULL) in rn_lookup()
246 return (x); in rn_lookup()
252 const char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; in rn_satisfies_leaf()
268 * Search for longest-prefix match in given @head
274 struct radix_node *t = head->rnh_treetop, *x; in rn_match() local
278 int off = t->rn_offset, vlen = LEN(cp), matched_off; in rn_match()
285 for (; t->rn_bit >= 0; ) { in rn_match()
286 if (t->rn_bmask & cp[t->rn_offset]) in rn_match()
287 t = t->rn_right; in rn_match()
289 t = t->rn_left; in rn_match()
293 * or at least learn how many bits match, for normal mask finesse. in rn_match()
296 * to the length of the mask, since if it matches we had a genuine in rn_match()
302 if (t->rn_mask) in rn_match()
303 vlen = *(u_char *)t->rn_mask; in rn_match()
304 cp += off; cp2 = t->rn_key + off; cplim = v + vlen; in rn_match()
315 if (t->rn_flags & RNF_ROOT) in rn_match()
316 t = t->rn_dupedkey; in rn_match()
321 b--; in rn_match()
322 matched_off = cp - v; in rn_match()
324 rn_bit = -1 - b; in rn_match()
326 * If there is a host route in a duped-key chain, it will be first. in rn_match()
328 if ((saved_t = t)->rn_mask == 0) in rn_match()
329 t = t->rn_dupedkey; in rn_match()
330 for (; t; t = t->rn_dupedkey) in rn_match()
336 if (t->rn_flags & RNF_NORMAL) { in rn_match()
337 if (rn_bit <= t->rn_bit) in rn_match()
345 t = t->rn_parent; in rn_match()
346 m = t->rn_mklist; in rn_match()
348 * If non-contiguous masks ever become important in rn_match()
354 if (m->rm_flags & RNF_NORMAL) { in rn_match()
355 if (rn_bit <= m->rm_bit) in rn_match()
356 return (m->rm_leaf); in rn_match()
358 off = min(t->rn_offset, matched_off); in rn_match()
359 x = rn_search_m(v, t, m->rm_mask); in rn_match()
360 while (x && x->rn_mask != m->rm_mask) in rn_match()
361 x = x->rn_dupedkey; in rn_match()
362 if (x && rn_satisfies_leaf(v, x, off)) in rn_match()
363 return (x); in rn_match()
365 m = m->rm_mklist; in rn_match()
378 for (rn = rn->rn_dupedkey; rn != NULL; rn = rn->rn_dupedkey) { in rn_nextprefix()
379 if (!(rn->rn_flags & RNF_ROOT)) in rn_nextprefix()
407 t->rn_bit = b; in rn_newpair()
408 t->rn_bmask = 0x80 >> (b & 7); in rn_newpair()
409 t->rn_left = tt; in rn_newpair()
410 t->rn_offset = b >> 3; in rn_newpair()
413 t->rn_parent = t->rn_right = NULL; in rn_newpair()
415 tt->rn_mask = NULL; in rn_newpair()
416 tt->rn_dupedkey = NULL; in rn_newpair()
417 tt->rn_bmask = 0; in rn_newpair()
419 tt->rn_bit = -1; in rn_newpair()
420 tt->rn_key = (caddr_t)v; in rn_newpair()
421 tt->rn_parent = t; in rn_newpair()
422 tt->rn_flags = t->rn_flags = RNF_ACTIVE; in rn_newpair()
423 tt->rn_mklist = t->rn_mklist = 0; in rn_newpair()
425 tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; in rn_newpair()
426 tt->rn_twin = t; in rn_newpair()
427 tt->rn_ybro = rn_clist; in rn_newpair()
438 struct radix_node *top = head->rnh_treetop; in rn_insert()
439 int head_off = top->rn_offset, vlen = LEN(v); in rn_insert()
443 struct radix_node *p, *tt, *x; in rn_insert() local
445 * Find first bit at which v and t->rn_key differ in rn_insert()
447 caddr_t cp2 = t->rn_key + head_off; in rn_insert()
458 cmp_res = (cp[-1] ^ cp2[-1]) & 0xff; in rn_insert()
459 for (b = (cp - v) << 3; cmp_res; b--) in rn_insert()
462 x = top; in rn_insert()
465 p = x; in rn_insert()
466 if (cp[x->rn_offset] & x->rn_bmask) in rn_insert()
467 x = x->rn_right; in rn_insert()
469 x = x->rn_left; in rn_insert()
470 } while (b > (unsigned) x->rn_bit); in rn_insert()
471 /* x->rn_bit < b && x->rn_bit >= 0 */ in rn_insert()
477 tt = t->rn_left; in rn_insert()
478 if ((cp[p->rn_offset] & p->rn_bmask) == 0) in rn_insert()
479 p->rn_left = t; in rn_insert()
481 p->rn_right = t; in rn_insert()
482 x->rn_parent = t; in rn_insert()
483 t->rn_parent = p; /* frees x, p as temp vars below */ in rn_insert()
484 if ((cp[t->rn_offset] & t->rn_bmask) == 0) { in rn_insert()
485 t->rn_right = x; in rn_insert()
487 t->rn_right = tt; in rn_insert()
488 t->rn_left = x; in rn_insert()
503 struct radix_node *x; in rn_addmask() local
514 return (maskhead->mask_nodes); in rn_addmask()
518 bcopy(rn_ones + 1, addmask_key + 1, skip - 1); in rn_addmask()
519 bcopy(netmask + skip, addmask_key + skip, mlen - skip); in rn_addmask()
523 for (cp = addmask_key + mlen; (cp > addmask_key) && cp[-1] == 0;) in rn_addmask()
524 cp--; in rn_addmask()
525 mlen = cp - addmask_key; in rn_addmask()
527 return (maskhead->mask_nodes); in rn_addmask()
529 x = rn_search(addmask_key, maskhead->head.rnh_treetop); in rn_addmask()
530 if (bcmp(addmask_key, x->rn_key, mlen) != 0) in rn_addmask()
531 x = NULL; in rn_addmask()
532 if (x || search) in rn_addmask()
533 return (x); in rn_addmask()
534 R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x)); in rn_addmask()
535 if ((saved_x = x) == NULL) in rn_addmask()
537 netmask = cp = (unsigned char *)(x + 2); in rn_addmask()
539 x = rn_insert(cp, &maskhead->head, &maskduplicated, x); in rn_addmask()
541 log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); in rn_addmask()
543 return (x); in rn_addmask()
546 * Calculate index of mask, and check for normalcy. in rn_addmask()
550 * a non-contiguous mask. in rn_addmask()
560 if (!CONTIG(*c) || c != (clim - 1)) in rn_addmask()
563 b += (c - netmask) << 3; in rn_addmask()
564 x->rn_bit = -1 - b; in rn_addmask()
566 x->rn_flags |= RNF_NORMAL; in rn_addmask()
567 return (x); in rn_addmask()
570 static int /* XXX: arbitrary ordering for non-contiguous masks */
591 log(LOG_ERR, "Failed to allocate route mask\n"); in rn_new_radix_mask()
595 m->rm_bit = tt->rn_bit; in rn_new_radix_mask()
596 m->rm_flags = tt->rn_flags; in rn_new_radix_mask()
597 if (tt->rn_flags & RNF_NORMAL) in rn_new_radix_mask()
598 m->rm_leaf = tt; in rn_new_radix_mask()
600 m->rm_mask = tt->rn_mask; in rn_new_radix_mask()
601 m->rm_mklist = next; in rn_new_radix_mask()
602 tt->rn_mklist = m; in rn_new_radix_mask()
611 struct radix_node *t, *x = NULL, *tt; in rn_addroute() local
612 struct radix_node *saved_tt, *top = head->rnh_treetop; in rn_addroute()
619 * In dealing with non-contiguous masks, there may be in rn_addroute()
620 * many different routes which have the same mask. in rn_addroute()
622 * the mask to speed avoiding duplicate references at in rn_addroute()
626 x = rn_addmask(n_arg, head->rnh_masks, 0, top->rn_offset); in rn_addroute()
627 if (x == NULL) in rn_addroute()
629 b_leaf = x->rn_bit; in rn_addroute()
630 b = -1 - x->rn_bit; in rn_addroute()
631 netmask = x->rn_key; in rn_addroute()
638 for (t = tt; tt; t = tt, tt = tt->rn_dupedkey) { in rn_addroute()
639 if (tt->rn_mask == netmask) in rn_addroute()
642 (tt->rn_mask && in rn_addroute()
643 ((b_leaf < tt->rn_bit) /* index(netmask) > node */ in rn_addroute()
644 || rn_refines(netmask, tt->rn_mask) in rn_addroute()
645 || rn_lexobetter(netmask, tt->rn_mask)))) in rn_addroute()
649 * If the mask is not duplicated, we wouldn't in rn_addroute()
654 * in a masklist -- most specific to least specific. in rn_addroute()
662 struct radix_node *xx = x; in rn_addroute()
664 (tt = treenodes)->rn_dupedkey = t; in rn_addroute()
665 tt->rn_flags = t->rn_flags; in rn_addroute()
666 tt->rn_parent = x = t->rn_parent; in rn_addroute()
667 t->rn_parent = tt; /* parent */ in rn_addroute()
668 if (x->rn_left == t) in rn_addroute()
669 x->rn_left = tt; in rn_addroute()
671 x->rn_right = tt; in rn_addroute()
672 saved_tt = tt; x = xx; in rn_addroute()
674 (tt = treenodes)->rn_dupedkey = t->rn_dupedkey; in rn_addroute()
675 t->rn_dupedkey = tt; in rn_addroute()
676 tt->rn_parent = t; /* parent */ in rn_addroute()
677 if (tt->rn_dupedkey) /* parent */ in rn_addroute()
678 tt->rn_dupedkey->rn_parent = tt; /* parent */ in rn_addroute()
681 t=tt+1; tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; in rn_addroute()
682 tt->rn_twin = t; tt->rn_ybro = rn_clist; rn_clist = tt; in rn_addroute()
684 tt->rn_key = (caddr_t) v; in rn_addroute()
685 tt->rn_bit = -1; in rn_addroute()
686 tt->rn_flags = RNF_ACTIVE; in rn_addroute()
689 * Put mask in tree. in rn_addroute()
692 tt->rn_mask = netmask; in rn_addroute()
693 tt->rn_bit = x->rn_bit; in rn_addroute()
694 tt->rn_flags |= x->rn_flags & RNF_NORMAL; in rn_addroute()
696 t = saved_tt->rn_parent; in rn_addroute()
699 b_leaf = -1 - t->rn_bit; in rn_addroute()
700 if (t->rn_right == saved_tt) in rn_addroute()
701 x = t->rn_left; in rn_addroute()
703 x = t->rn_right; in rn_addroute()
705 if (x->rn_bit < 0) { in rn_addroute()
706 for (mp = &t->rn_mklist; x; x = x->rn_dupedkey) in rn_addroute()
707 if (x->rn_mask && (x->rn_bit >= b_leaf) && x->rn_mklist == 0) { in rn_addroute()
708 *mp = m = rn_new_radix_mask(x, 0); in rn_addroute()
710 mp = &m->rm_mklist; in rn_addroute()
712 } else if (x->rn_mklist) { in rn_addroute()
716 for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) in rn_addroute()
717 if (m->rm_bit >= b_leaf) in rn_addroute()
719 t->rn_mklist = m; *mp = NULL; in rn_addroute()
723 if ((netmask == 0) || (b > t->rn_bit )) in rn_addroute()
725 b_leaf = tt->rn_bit; in rn_addroute()
727 x = t; in rn_addroute()
728 t = t->rn_parent; in rn_addroute()
729 } while (b <= t->rn_bit && x != top); in rn_addroute()
736 for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) { in rn_addroute()
737 if (m->rm_bit < b_leaf) in rn_addroute()
739 if (m->rm_bit > b_leaf) in rn_addroute()
741 if (m->rm_flags & RNF_NORMAL) { in rn_addroute()
742 mmask = m->rm_leaf->rn_mask; in rn_addroute()
743 if (tt->rn_flags & RNF_NORMAL) { in rn_addroute()
745 "Non-unique normal route, mask not entered\n"); in rn_addroute()
749 mmask = m->rm_mask; in rn_addroute()
751 m->rm_refs++; in rn_addroute()
752 tt->rn_mklist = m; in rn_addroute()
766 struct radix_node *t, *p, *x, *tt; in rn_delete() local
775 x = head->rnh_treetop; in rn_delete()
776 tt = rn_search(v, x); in rn_delete()
777 head_off = x->rn_offset; in rn_delete()
780 top = x; in rn_delete()
782 bcmp(v + head_off, tt->rn_key + head_off, vlen - head_off)) in rn_delete()
785 * Delete our route from mask lists. in rn_delete()
788 x = rn_addmask(netmask, head->rnh_masks, 1, head_off); in rn_delete()
789 if (x == NULL) in rn_delete()
791 netmask = x->rn_key; in rn_delete()
792 while (tt->rn_mask != netmask) in rn_delete()
793 if ((tt = tt->rn_dupedkey) == NULL) in rn_delete()
796 if (tt->rn_mask == 0 || (saved_m = m = tt->rn_mklist) == NULL) in rn_delete()
798 if (tt->rn_flags & RNF_NORMAL) { in rn_delete()
799 if (m->rm_leaf != tt || m->rm_refs > 0) { in rn_delete()
804 if (m->rm_mask != tt->rn_mask) { in rn_delete()
808 if (--m->rm_refs >= 0) in rn_delete()
811 b = -1 - tt->rn_bit; in rn_delete()
812 t = saved_tt->rn_parent; in rn_delete()
813 if (b > t->rn_bit) in rn_delete()
816 x = t; in rn_delete()
817 t = t->rn_parent; in rn_delete()
818 } while (b <= t->rn_bit && x != top); in rn_delete()
819 for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) in rn_delete()
821 *mp = m->rm_mklist; in rn_delete()
827 if (tt->rn_flags & RNF_NORMAL) in rn_delete()
834 if (tt->rn_flags & RNF_ROOT) in rn_delete()
838 for (t = rn_clist; t && t->rn_ybro != tt; t = t->rn_ybro) {} in rn_delete()
839 if (t) t->rn_ybro = tt->rn_ybro; in rn_delete()
841 t = tt->rn_parent; in rn_delete()
842 dupedkey = saved_tt->rn_dupedkey; in rn_delete()
850 x = dupedkey; x->rn_parent = t; in rn_delete()
851 if (t->rn_left == tt) in rn_delete()
852 t->rn_left = x; in rn_delete()
854 t->rn_right = x; in rn_delete()
857 for (x = p = saved_tt; p && p->rn_dupedkey != tt;) in rn_delete()
858 p = p->rn_dupedkey; in rn_delete()
860 p->rn_dupedkey = tt->rn_dupedkey; in rn_delete()
861 if (tt->rn_dupedkey) /* parent */ in rn_delete()
862 tt->rn_dupedkey->rn_parent = p; in rn_delete()
867 if (t->rn_flags & RNF_ACTIVE) { in rn_delete()
869 *++x = *t; in rn_delete()
870 p = t->rn_parent; in rn_delete()
872 b = t->rn_info; in rn_delete()
873 *++x = *t; in rn_delete()
874 t->rn_info = b; in rn_delete()
875 p = t->rn_parent; in rn_delete()
877 if (p->rn_left == t) in rn_delete()
878 p->rn_left = x; in rn_delete()
880 p->rn_right = x; in rn_delete()
881 x->rn_left->rn_parent = x; in rn_delete()
882 x->rn_right->rn_parent = x; in rn_delete()
886 if (t->rn_left == tt) in rn_delete()
887 x = t->rn_right; in rn_delete()
889 x = t->rn_left; in rn_delete()
890 p = t->rn_parent; in rn_delete()
891 if (p->rn_right == t) in rn_delete()
892 p->rn_right = x; in rn_delete()
894 p->rn_left = x; in rn_delete()
895 x->rn_parent = p; in rn_delete()
899 if (t->rn_mklist) { in rn_delete()
900 if (x->rn_bit >= 0) { in rn_delete()
901 for (mp = &x->rn_mklist; (m = *mp);) in rn_delete()
902 mp = &m->rm_mklist; in rn_delete()
903 *mp = t->rn_mklist; in rn_delete()
905 /* If there are any key,mask pairs in a sibling in rn_delete()
906 duped-key chain, some subset will appear sorted in rn_delete()
908 for (m = t->rn_mklist; m && x; x = x->rn_dupedkey) in rn_delete()
909 if (m == x->rn_mklist) { in rn_delete()
910 struct radix_mask *mm = m->rm_mklist; in rn_delete()
911 x->rn_mklist = 0; in rn_delete()
912 if (--(m->rm_refs) < 0) in rn_delete()
918 "rn_delete: Orphaned Mask %p at %p\n", in rn_delete()
919 m, x); in rn_delete()
925 x = tt + 1; in rn_delete()
926 if (t != x) { in rn_delete()
928 *t = *x; in rn_delete()
930 b = t->rn_info; in rn_delete()
931 *t = *x; in rn_delete()
932 t->rn_info = b; in rn_delete()
934 t->rn_left->rn_parent = t; in rn_delete()
935 t->rn_right->rn_parent = t; in rn_delete()
936 p = x->rn_parent; in rn_delete()
937 if (p->rn_left == x) in rn_delete()
938 p->rn_left = t; in rn_delete()
940 p->rn_right = t; in rn_delete()
943 tt->rn_flags &= ~RNF_ACTIVE; in rn_delete()
964 KASSERT(m != NULL, ("%s: mask needs to be specified", __func__)); in rn_walktree_from()
967 * rn_search_m is sort-of-open-coded here. We cannot use the in rn_walktree_from()
971 for (rn = h->rnh_treetop; rn->rn_bit >= 0; ) { in rn_walktree_from()
973 /* printf("rn_bit %d, rn_bmask %x, xm[rn_offset] %x\n", in rn_walktree_from()
974 rn->rn_bit, rn->rn_bmask, xm[rn->rn_offset]); */ in rn_walktree_from()
975 if (!(rn->rn_bmask & xm[rn->rn_offset])) { in rn_walktree_from()
978 if (rn->rn_bmask & xa[rn->rn_offset]) { in rn_walktree_from()
979 rn = rn->rn_right; in rn_walktree_from()
981 rn = rn->rn_left; in rn_walktree_from()
987 * Two cases: either we stepped off the end of our mask, in rn_walktree_from()
991 if (rn->rn_bit >= 0) in rn_walktree_from()
993 lastb = last->rn_bit; in rn_walktree_from()
1002 while (rn->rn_bit >= 0) in rn_walktree_from()
1003 rn = rn->rn_left; in rn_walktree_from()
1006 /* printf("node %p (%d)\n", rn, rn->rn_bit); */ in rn_walktree_from()
1009 while (rn->rn_parent->rn_right == rn in rn_walktree_from()
1010 && !(rn->rn_flags & RNF_ROOT)) { in rn_walktree_from()
1011 rn = rn->rn_parent; in rn_walktree_from()
1014 if (rn->rn_bit <= lastb) { in rn_walktree_from()
1032 if (rn->rn_parent->rn_flags & RNF_ROOT) in rn_walktree_from()
1036 for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) in rn_walktree_from()
1037 rn = rn->rn_left; in rn_walktree_from()
1041 base = rn->rn_dupedkey; in rn_walktree_from()
1043 if (!(rn->rn_flags & RNF_ROOT) in rn_walktree_from()
1049 if (rn->rn_flags & RNF_ROOT) { in rn_walktree_from()
1062 struct radix_node *rn = h->rnh_treetop; in rn_walktree()
1070 while (rn->rn_bit >= 0) in rn_walktree()
1071 rn = rn->rn_left; in rn_walktree()
1075 while (rn->rn_parent->rn_right == rn in rn_walktree()
1076 && (rn->rn_flags & RNF_ROOT) == 0) in rn_walktree()
1077 rn = rn->rn_parent; in rn_walktree()
1079 for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) in rn_walktree()
1080 rn = rn->rn_left; in rn_walktree()
1084 base = rn->rn_dupedkey; in rn_walktree()
1085 if (!(rn->rn_flags & RNF_ROOT) in rn_walktree()
1090 if (rn->rn_flags & RNF_ROOT) in rn_walktree()
1100 * The leaves have all-zero and all-one keys, with significant
1110 t->rn_right = ttt; in rn_inithead_internal()
1111 t->rn_parent = t; in rn_inithead_internal()
1112 tt = t->rn_left; /* ... which in turn is base_nodes */ in rn_inithead_internal()
1113 tt->rn_flags = t->rn_flags = RNF_ROOT | RNF_ACTIVE; in rn_inithead_internal()
1114 tt->rn_bit = -1 - off; in rn_inithead_internal()
1116 ttt->rn_key = rn_ones; in rn_inithead_internal()
1118 rh->rnh_treetop = t; in rn_inithead_internal()
1157 rn_inithead_internal(&rnh->rh, rnh->rnh_nodes, off); in rn_inithead()
1158 rn_inithead_internal(&rmh->head, rmh->mask_nodes, 0); in rn_inithead()
1160 rnh->rh.rnh_masks = rmh; in rn_inithead()
1163 rnh->rnh_addaddr = rn_addroute; in rn_inithead()
1164 rnh->rnh_deladdr = rn_delete; in rn_inithead()
1165 rnh->rnh_matchaddr = rn_match; in rn_inithead()
1166 rnh->rnh_lookup = rn_lookup; in rn_inithead()
1167 rnh->rnh_walktree = rn_walktree; in rn_inithead()
1168 rnh->rnh_walktree_from = rn_walktree_from; in rn_inithead()
1177 struct radix_node *x; in rn_freeentry() local
1179 x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh); in rn_freeentry()
1180 if (x != NULL) in rn_freeentry()
1181 R_Free(x); in rn_freeentry()
1195 rn_walktree(&rnh->rh.rnh_masks->head, rn_freeentry, rnh->rh.rnh_masks); in rn_detachhead()
1196 rn_detachhead_internal(&rnh->rh.rnh_masks->head); in rn_detachhead()
1197 rn_detachhead_internal(&rnh->rh); in rn_detachhead()