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

Function defrouter_del

freebsd/netinet6/nd6_rtr.c:749–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749static void
750defrouter_del(struct nd_defrouter *dr)
751{
752 struct nd_defrouter *deldr = NULL;
753 struct nd_prefix *pr;
754 struct nd_pfxrouter *pfxrtr;
755
756 ND6_UNLOCK_ASSERT();
757
758 /*
759 * Flush all the routing table entries that use the router
760 * as a next hop.
761 */
762 if (ND_IFINFO(dr->ifp)->flags & ND6_IFF_ACCEPT_RTADV)
763 rt6_flush(&dr->rtaddr, dr->ifp);
764
765#ifdef EXPERIMENTAL
766 defrtr_ipv6_only_ifp(dr->ifp);
767#endif
768
769 if (dr->installed) {
770 deldr = dr;
771 defrouter_delreq(dr);
772 }
773
774 /*
775 * Also delete all the pointers to the router in each prefix lists.
776 */
777 ND6_WLOCK();
778 LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) {
779 if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL)
780 pfxrtr_del(pfxrtr);
781 }
782 ND6_WUNLOCK();
783
784 pfxlist_onlink_check();
785
786 /*
787 * If the router is the primary one, choose a new one.
788 * Note that defrouter_select_fib() will remove the current
789 * gateway from the routing table.
790 */
791 if (deldr)
792 defrouter_select_fib(deldr->ifp->if_fib);
793
794 /*
795 * Release the list reference.
796 */
797 defrouter_rele(dr);
798}
799
800struct nd_defrouter *
801defrouter_lookup_locked(const struct in6_addr *addr, struct ifnet *ifp)

Callers 4

defrouter_removeFunction · 0.85
nd6_defrouter_timerFunction · 0.85
nd6_defrouter_purgeFunction · 0.85
nd6_defrouter_flush_allFunction · 0.85

Calls 8

rt6_flushFunction · 0.85
defrtr_ipv6_only_ifpFunction · 0.85
defrouter_delreqFunction · 0.85
pfxrtr_lookupFunction · 0.85
pfxrtr_delFunction · 0.85
pfxlist_onlink_checkFunction · 0.85
defrouter_select_fibFunction · 0.85
defrouter_releFunction · 0.85

Tested by

no test coverage detected