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