MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfxrtr_add

Function pfxrtr_add

freebsd/netinet6/nd6_rtr.c:624–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624static void
625pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr)
626{
627 struct nd_pfxrouter *new;
628 bool update;
629
630 ND6_UNLOCK_ASSERT();
631
632 ND6_RLOCK();
633 if (pfxrtr_lookup(pr, dr) != NULL) {
634 ND6_RUNLOCK();
635 return;
636 }
637 ND6_RUNLOCK();
638
639 new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT | M_ZERO);
640 if (new == NULL)
641 return;
642 defrouter_ref(dr);
643 new->router = dr;
644
645 ND6_WLOCK();
646 if (pfxrtr_lookup(pr, dr) == NULL) {
647 LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry);
648 update = true;
649 } else {
650 /* We lost a race to add the reference. */
651 defrouter_rele(dr);
652 free(new, M_IP6NDP);
653 update = false;
654 }
655 ND6_WUNLOCK();
656
657 if (update)
658 pfxlist_onlink_check();
659}
660
661static void
662pfxrtr_del(struct nd_pfxrouter *pfr)

Callers 2

nd6_prelist_addFunction · 0.85
prelist_updateFunction · 0.85

Calls 6

pfxrtr_lookupFunction · 0.85
mallocFunction · 0.85
defrouter_refFunction · 0.85
defrouter_releFunction · 0.85
pfxlist_onlink_checkFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected