Lines Matching refs:astate
103 arp_report_conflicted(const struct arp_state *astate, const struct arp_msg *amsg) in arp_report_conflicted() argument
109 logger(astate->iface->ctx, LOG_ERR, in arp_report_conflicted()
111 astate->iface->name, in arp_report_conflicted()
112 hwaddr_ntoa(amsg->sha, astate->iface->hwlen, in arp_report_conflicted()
114 inet_ntoa(astate->failed)); in arp_report_conflicted()
116 logger(astate->iface->ctx, LOG_ERR, in arp_report_conflicted()
118 astate->iface->name, inet_ntoa(astate->failed)); in arp_report_conflicted()
131 struct arp_state *astate, *astaten; in arp_packet() local
185 TAILQ_FOREACH_SAFE(astate, &state->arp_states, next, astaten) { in arp_packet()
186 if (astate->conflicted_cb) in arp_packet()
187 astate->conflicted_cb(astate, &arm); in arp_packet()
213 struct arp_state *astate = arg; in arp_announced() local
215 if (astate->announced_cb) { in arp_announced()
216 astate->announced_cb(astate); in arp_announced()
221 arp_free(astate); in arp_announced()
227 struct arp_state *astate = arg; in arp_announce1() local
228 struct interface *ifp = astate->iface; in arp_announce1()
230 if (++astate->claims < ANNOUNCE_NUM) in arp_announce1()
234 ifp->name, inet_ntoa(astate->addr), in arp_announce1()
235 astate->claims, ANNOUNCE_NUM, ANNOUNCE_WAIT); in arp_announce1()
239 ifp->name, inet_ntoa(astate->addr), in arp_announce1()
240 astate->claims, ANNOUNCE_NUM); in arp_announce1()
241 if (arp_request(ifp, astate->addr.s_addr, astate->addr.s_addr, in arp_announce1()
245 astate->claims < ANNOUNCE_NUM ? arp_announce1 : arp_announced, in arp_announce1()
246 astate); in arp_announce1()
250 arp_announce(struct arp_state *astate) in arp_announce() argument
253 arp_open(astate->iface); in arp_announce()
254 astate->claims = 0; in arp_announce()
255 arp_announce1(astate); in arp_announce()
261 struct arp_state *astate = arg; in arp_probed() local
263 astate->probed_cb(astate); in arp_probed()
269 struct arp_state *astate = arg; in arp_probe1() local
270 struct interface *ifp = astate->iface; in arp_probe1()
274 if (++astate->probes < PROBE_NUM) { in arp_probe1()
279 eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probe1, astate); in arp_probe1()
283 eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probed, astate); in arp_probe1()
287 ifp->name, inet_ntoa(astate->addr), in arp_probe1()
288 astate->probes ? astate->probes : PROBE_NUM, PROBE_NUM, in arp_probe1()
290 if (astate->dest_hwlen == ifp->hwlen) in arp_probe1()
291 dest_hwaddr = astate->dest_hwaddr; in arp_probe1()
292 if (arp_request(ifp, astate->src_addr.s_addr, in arp_probe1()
293 astate->addr.s_addr, dest_hwaddr) == -1) in arp_probe1()
298 arp_probe(struct arp_state *astate) in arp_probe() argument
301 arp_open(astate->iface); in arp_probe()
302 astate->probes = 0; in arp_probe()
303 logger(astate->iface->ctx, LOG_DEBUG, "%s: probing for %s", in arp_probe()
304 astate->iface->name, inet_ntoa(astate->addr)); in arp_probe()
305 arp_probe1(astate); in arp_probe()
311 struct arp_state *astate; in arp_find() local
315 TAILQ_FOREACH(astate, &state->arp_states, next) { in arp_find()
316 if (astate->addr.s_addr == addr->s_addr && astate->iface == ifp) in arp_find()
317 return astate; in arp_find()
326 struct arp_state *astate; in arp_new() local
329 if (addr && (astate = arp_find(ifp, addr))) in arp_new()
330 return astate; in arp_new()
332 if ((astate = calloc(1, sizeof(*astate))) == NULL) { in arp_new()
337 astate->iface = ifp; in arp_new()
339 astate->addr = *addr; in arp_new()
340 TAILQ_INSERT_TAIL(&state->arp_states, astate, next); in arp_new()
341 return astate; in arp_new()
345 arp_cancel(struct arp_state *astate) in arp_cancel() argument
348 eloop_timeout_delete(astate->iface->ctx->eloop, NULL, astate); in arp_cancel()
352 arp_free(struct arp_state *astate) in arp_free() argument
356 if (astate) { in arp_free()
357 eloop_timeout_delete(astate->iface->ctx->eloop, NULL, astate); in arp_free()
358 state = D_STATE(astate->iface); in arp_free()
359 TAILQ_REMOVE(&state->arp_states, astate, next); in arp_free()
360 if (state->arp_ipv4ll == astate) { in arp_free()
361 ipv4ll_stop(astate->iface); in arp_free()
364 free(astate); in arp_free()
369 arp_free_but(struct arp_state *astate) in arp_free_but() argument
374 state = D_STATE(astate->iface); in arp_free_but()
376 if (p != astate) in arp_free_but()
385 struct arp_state *astate; in arp_close() local
396 while ((astate = TAILQ_FIRST(&state->arp_states))) { in arp_close()
400 arp_free(astate); in arp_close()
411 struct arp_state *astate, *asn; in arp_handleifa() local
416 TAILQ_FOREACH_SAFE(astate, &state->arp_states, next, asn) { in arp_handleifa()
417 if (astate->addr.s_addr == addr->s_addr) { in arp_handleifa()
419 if (astate->conflicted_cb) in arp_handleifa()
420 astate->conflicted_cb(astate, NULL); in arp_handleifa()
422 if (astate->probed_cb) in arp_handleifa()
423 astate->probed_cb(astate); in arp_handleifa()