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

Function nd6_free

freebsd/netinet6/nd6.c:1401–1538  ·  view source on GitHub ↗

* Free an nd6 llinfo entry. * Since the function would cause significant changes in the kernel, DO NOT * make it global, unless you have a strong reason for the change, and are sure * that the change is safe. * * Set noinline to be dtrace-friendly */

Source from the content-addressed store, hash-verified

1399 * Set noinline to be dtrace-friendly
1400 */
1401static __noinline void
1402nd6_free(struct llentry **lnp, int gc)
1403{
1404 struct ifnet *ifp;
1405 struct llentry *ln;
1406 struct nd_defrouter *dr;
1407
1408 ln = *lnp;
1409 *lnp = NULL;
1410
1411 LLE_WLOCK_ASSERT(ln);
1412 ND6_RLOCK_ASSERT();
1413
1414 ifp = lltable_get_ifp(ln->lle_tbl);
1415 if ((ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) != 0)
1416 dr = defrouter_lookup_locked(&ln->r_l3addr.addr6, ifp);
1417 else
1418 dr = NULL;
1419 ND6_RUNLOCK();
1420
1421 if ((ln->la_flags & LLE_DELETED) == 0)
1422 EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_EXPIRED);
1423
1424 /*
1425 * we used to have pfctlinput(PRC_HOSTDEAD) here.
1426 * even though it is not harmful, it was not really necessary.
1427 */
1428
1429 /* cancel timer */
1430 nd6_llinfo_settimer_locked(ln, -1);
1431
1432 if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) {
1433 if (dr != NULL && dr->expire &&
1434 ln->ln_state == ND6_LLINFO_STALE && gc) {
1435 /*
1436 * If the reason for the deletion is just garbage
1437 * collection, and the neighbor is an active default
1438 * router, do not delete it. Instead, reset the GC
1439 * timer using the router's lifetime.
1440 * Simply deleting the entry would affect default
1441 * router selection, which is not necessarily a good
1442 * thing, especially when we're using router preference
1443 * values.
1444 * XXX: the check for ln_state would be redundant,
1445 * but we intentionally keep it just in case.
1446 */
1447 if (dr->expire > time_uptime)
1448 nd6_llinfo_settimer_locked(ln,
1449 (dr->expire - time_uptime) * hz);
1450 else
1451 nd6_llinfo_settimer_locked(ln,
1452 (long)V_nd6_gctimer * hz);
1453
1454 LLE_REMREF(ln);
1455 LLE_WUNLOCK(ln);
1456 defrouter_rele(dr);
1457 return;
1458 }

Callers 1

nd6_llinfo_timerFunction · 0.85

Calls 10

lltable_get_ifpFunction · 0.85
defrouter_lookup_lockedFunction · 0.85
defrouter_releFunction · 0.85
rt6_flushFunction · 0.85
pfxlist_onlink_checkFunction · 0.85
defrouter_select_fibFunction · 0.85
nd6_free_redirectFunction · 0.85
lltable_unlink_entryFunction · 0.85
llentry_freeFunction · 0.85

Tested by

no test coverage detected