Lines Matching defs:astate
73 ipv4ll_pick_addr(const struct arp_state *astate)
87 if (addr == astate->failed.s_addr)
91 TAILQ_FOREACH(ifp, astate->iface->ctx->ifaces, next) {
105 ipv4ll_probed(struct arp_state *astate)
107 struct dhcp_state *state = D_STATE(astate->iface);
110 ipv4_finaliseaddr(astate->iface);
120 state->offer = ipv4ll_make_lease(astate->addr.s_addr);
122 logger(astate->iface->ctx, LOG_ERR, "%s: %m", __func__);
124 dhcp_bind(astate->iface, astate);
130 ipv4ll_announced(struct arp_state *astate)
132 struct dhcp_state *state = D_STATE(astate->iface);
150 ipv4ll_conflicted(struct arp_state *astate, const struct arp_msg *amsg)
152 struct dhcp_state *state = D_STATE(astate->iface);
158 (amsg->sip.s_addr == astate->addr.s_addr ||
159 (amsg->sip.s_addr == 0 && amsg->tip.s_addr == astate->addr.s_addr)))
160 fail = astate->addr.s_addr;
170 astate->failed.s_addr = fail;
171 arp_report_conflicted(astate, amsg);
173 if (astate->failed.s_addr == state->addr.s_addr) {
179 logger(astate->iface->ctx, LOG_WARNING,
181 astate->iface->name, DEFEND_INTERVAL,
183 dhcp_drop(astate->iface, "EXPIRE");
185 logger(astate->iface->ctx, LOG_DEBUG,
187 astate->iface->name, inet_ntoa(state->addr));
193 arp_cancel(astate);
195 logger(astate->iface->ctx, LOG_ERR,
197 astate->iface->name);
198 astate->addr.s_addr = ipv4ll_pick_addr(astate);
199 eloop_timeout_add_sec(astate->iface->ctx->eloop,
202 ipv4ll_probe, astate);
210 struct arp_state *astate;
232 if ((astate = arp_new(ifp, NULL)) == NULL)
235 state->arp_ipv4ll = astate;
236 astate->probed_cb = ipv4ll_probed;
237 astate->announced_cb = ipv4ll_announced;
238 astate->conflicted_cb = ipv4ll_conflicted;
241 astate->addr = state->addr;
242 arp_announce(astate);
247 astate->addr.s_addr = state->offer->yiaddr;
250 ap = ipv4_iffindaddr(ifp, &astate->addr, NULL);
254 astate->addr = ap->addr;
255 ipv4ll_probed(astate);
261 if (!IN_LINKLOCAL(htonl(astate->addr.s_addr))) {
264 astate->addr.s_addr = INADDR_ANY;
266 if (astate->addr.s_addr == INADDR_ANY)
267 astate->addr.s_addr = ipv4ll_pick_addr(astate);
269 ipv4ll_probed(astate);
271 arp_probe(astate);