Lines Matching refs:ifp
58 arp_request(const struct interface *ifp, in_addr_t sip, in_addr_t tip,
66 ar.ar_hrd = htons(ifp->family);
68 ar.ar_hln = ifp->hwlen;
87 APPEND(ifp->hwaddr, ifp->hwlen);
90 APPEND(dest_hw_addr, ifp->hwlen);
92 ZERO(ifp->hwlen);
94 return if_sendrawpacket(ifp, ETHERTYPE_ARP, arp_buffer, len,
124 struct interface *ifp = arg;
135 state = D_STATE(ifp);
139 bytes = if_readrawpacket(ifp, ETHERTYPE_ARP,
142 logger(ifp->ctx, LOG_ERR,
143 "%s: arp if_readrawpacket: %m", ifp->name);
144 dhcp_close(ifp);
152 if (ar.ar_hrd != htons(ifp->family))
171 TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
193 arp_open(struct interface *ifp)
197 state = D_STATE(ifp);
199 state->arp_fd = if_openrawsocket(ifp, ETHERTYPE_ARP);
201 logger(ifp->ctx, LOG_ERR, "%s: %s: %m",
202 __func__, ifp->name);
205 eloop_event_add(ifp->ctx->eloop, state->arp_fd,
206 arp_packet, ifp, NULL, NULL);
228 struct interface *ifp = astate->iface;
231 logger(ifp->ctx, LOG_DEBUG,
234 ifp->name, inet_ntoa(astate->addr),
237 logger(ifp->ctx, LOG_DEBUG,
239 ifp->name, inet_ntoa(astate->addr),
241 if (arp_request(ifp, astate->addr.s_addr, astate->addr.s_addr,
243 logger(ifp->ctx, LOG_ERR, "send_arp: %m");
244 eloop_timeout_add_sec(ifp->ctx->eloop, ANNOUNCE_WAIT,
270 struct interface *ifp = astate->iface;
279 eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probe1, astate);
283 eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probed, astate);
285 logger(ifp->ctx, LOG_INFO,
287 ifp->name, inet_ntoa(astate->addr),
290 if (astate->dest_hwlen == ifp->hwlen)
292 if (arp_request(ifp, astate->src_addr.s_addr,
294 logger(ifp->ctx, LOG_ERR, "send_arp: %m");
309 arp_find(struct interface *ifp, const struct in_addr *addr)
314 state = D_STATE(ifp);
316 if (astate->addr.s_addr == addr->s_addr && astate->iface == ifp)
324 arp_new(struct interface *ifp, const struct in_addr *addr)
329 if (addr && (astate = arp_find(ifp, addr)))
333 logger(ifp->ctx, LOG_ERR, "%s: %s: %m", ifp->name, __func__);
336 state = D_STATE(ifp);
337 astate->iface = ifp;
382 arp_close(struct interface *ifp)
384 struct dhcp_state *state = D_STATE(ifp);
391 eloop_event_delete(ifp->ctx->eloop, state->arp_fd, 0);
406 arp_handleifa(int cmd, struct interface *ifp, const struct in_addr *addr,
410 struct dhcp_state *state = D_STATE(ifp);
413 if (cmd != RTM_NEWADDR || (state = D_STATE(ifp)) == NULL)
429 UNUSED(ifp);