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

Function nd6_timer

freebsd/netinet6/nd6.c:919–1077  ·  view source on GitHub ↗

* ND6 timer routine to expire default route list and prefix list */

Source from the content-addressed store, hash-verified

917 * ND6 timer routine to expire default route list and prefix list
918 */
919void
920nd6_timer(void *arg)
921{
922 CURVNET_SET((struct vnet *) arg);
923 struct epoch_tracker et;
924 struct nd_prhead prl;
925 struct nd_prefix *pr, *npr;
926 struct ifnet *ifp;
927 struct in6_ifaddr *ia6, *nia6;
928 uint64_t genid;
929
930 LIST_INIT(&prl);
931
932 NET_EPOCH_ENTER(et);
933 nd6_defrouter_timer();
934
935 /*
936 * expire interface addresses.
937 * in the past the loop was inside prefix expiry processing.
938 * However, from a stricter speci-confrmance standpoint, we should
939 * rather separate address lifetimes and prefix lifetimes.
940 *
941 * XXXRW: in6_ifaddrhead locking.
942 */
943 addrloop:
944 CK_STAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) {
945 /* check address lifetime */
946 if (IFA6_IS_INVALID(ia6)) {
947 int regen = 0;
948
949 /*
950 * If the expiring address is temporary, try
951 * regenerating a new one. This would be useful when
952 * we suspended a laptop PC, then turned it on after a
953 * period that could invalidate all temporary
954 * addresses. Although we may have to restart the
955 * loop (see below), it must be after purging the
956 * address. Otherwise, we'd see an infinite loop of
957 * regeneration.
958 */
959 if (V_ip6_use_tempaddr &&
960 (ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0) {
961 if (regen_tmpaddr(ia6) == 0)
962 regen = 1;
963 }
964
965 in6_purgeaddr(&ia6->ia_ifa);
966
967 if (regen)
968 goto addrloop; /* XXX: see below */
969 } else if (IFA6_IS_DEPRECATED(ia6)) {
970 int oldflags = ia6->ia6_flags;
971
972 ia6->ia6_flags |= IN6_IFF_DEPRECATED;
973
974 /*
975 * If a temporary address has just become deprecated,
976 * regenerate a new one if possible.

Callers

nothing calls this directly

Calls 10

nd6_defrouter_timerFunction · 0.85
regen_tmpaddrFunction · 0.85
in6_purgeaddrFunction · 0.85
nd6_dad_startFunction · 0.85
nd6_prefix_unlinkFunction · 0.85
nd6_prefix_refFunction · 0.85
nd6_prefix_offlinkFunction · 0.85
nd6_prefix_releFunction · 0.85
nd6_prefix_delFunction · 0.85
arc4randomFunction · 0.50

Tested by

no test coverage detected