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

Function arp_add_ifa_lle

freebsd/netinet/if_ether.c:1289–1323  ·  view source on GitHub ↗

* Add permanent link-layer record for given interface address. */

Source from the content-addressed store, hash-verified

1287 * Add permanent link-layer record for given interface address.
1288 */
1289static __noinline void
1290arp_add_ifa_lle(struct ifnet *ifp, const struct sockaddr *dst)
1291{
1292 struct llentry *lle, *lle_tmp;
1293
1294 /*
1295 * Interface address LLE record is considered static
1296 * because kernel code relies on LLE_STATIC flag to check
1297 * if these entries can be rewriten by arp updates.
1298 */
1299 lle = lltable_alloc_entry(LLTABLE(ifp), LLE_IFADDR | LLE_STATIC, dst);
1300 if (lle == NULL) {
1301 log(LOG_INFO, "arp_ifinit: cannot create arp "
1302 "entry for interface address\n");
1303 return;
1304 }
1305
1306 IF_AFDATA_WLOCK(ifp);
1307 LLE_WLOCK(lle);
1308 /* Unlink any entry if exists */
1309 lle_tmp = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, dst);
1310 if (lle_tmp != NULL)
1311 lltable_unlink_entry(LLTABLE(ifp), lle_tmp);
1312
1313 lltable_link_entry(LLTABLE(ifp), lle);
1314 IF_AFDATA_WUNLOCK(ifp);
1315
1316 if (lle_tmp != NULL)
1317 EVENTHANDLER_INVOKE(lle_event, lle_tmp, LLENTRY_EXPIRED);
1318
1319 EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_RESOLVED);
1320 LLE_WUNLOCK(lle);
1321 if (lle_tmp != NULL)
1322 lltable_free_entry(LLTABLE(ifp), lle_tmp);
1323}
1324
1325/*
1326 * Handle the garp_rexmit_count. Like sysctl_handle_int(), but limits the range

Callers 1

arp_ifinitFunction · 0.85

Calls 6

lltable_alloc_entryFunction · 0.85
lla_lookupFunction · 0.85
lltable_unlink_entryFunction · 0.85
lltable_link_entryFunction · 0.85
lltable_free_entryFunction · 0.85
logFunction · 0.50

Tested by

no test coverage detected