Lines Matching refs:ifp
166 ipv6rs_makeprobe(struct interface *ifp) in ipv6rs_makeprobe() argument
171 free(ifp->rs); in ipv6rs_makeprobe()
172 ifp->rslen = sizeof(*rs) + ROUNDUP8(ifp->hwlen + 2); in ipv6rs_makeprobe()
173 ifp->rs = xzalloc(ifp->rslen); in ipv6rs_makeprobe()
174 if (ifp->rs == NULL) in ipv6rs_makeprobe()
176 rs = (struct nd_router_solicit *)ifp->rs; in ipv6rs_makeprobe()
181 nd = (struct nd_opt_hdr *)(ifp->rs + sizeof(*rs)); in ipv6rs_makeprobe()
183 nd->nd_opt_len = (ROUNDUP8(ifp->hwlen + 2)) >> 3; in ipv6rs_makeprobe()
184 memcpy(nd + 1, ifp->hwaddr, ifp->hwlen); in ipv6rs_makeprobe()
191 struct interface *ifp = arg; in ipv6rs_sendprobe() local
200 ipv6rs_makeprobe(ifp); in ipv6rs_sendprobe()
202 sndhdr.msg_iov[0].iov_base = ifp->rs; in ipv6rs_sendprobe()
203 sndhdr.msg_iov[0].iov_len = ifp->rslen; in ipv6rs_sendprobe()
211 pi.ipi6_ifindex = if_nametoindex(ifp->name); in ipv6rs_sendprobe()
221 syslog(LOG_INFO, "%s: sending IPv6 Router Solicitation", ifp->name); in ipv6rs_sendprobe()
223 syslog(LOG_ERR, "%s: sendmsg: %m", ifp->name); in ipv6rs_sendprobe()
225 if (ifp->rsprobes++ < MAX_RTR_SOLICITATIONS) in ipv6rs_sendprobe()
227 ipv6rs_sendprobe, ifp); in ipv6rs_sendprobe()
229 syslog(LOG_INFO, "%s: no IPv6 Routers available", ifp->name); in ipv6rs_sendprobe()
233 ipv6rs_sort(struct interface *ifp) in ipv6rs_sort() argument
237 if (ifp->ras == NULL || ifp->ras->next == NULL) in ipv6rs_sort()
241 sorted = ifp->ras; in ipv6rs_sort()
242 ifp->ras = ifp->ras->next; in ipv6rs_sort()
244 for (rap = ifp->ras; rap && (ran = rap->next, 1); rap = ran) { in ipv6rs_sort()
275 struct interface *ifp; in ipv6rs_handledata() local
346 for (ifp = ifaces; ifp; ifp = ifp->next) in ipv6rs_handledata()
347 if (if_nametoindex(ifp->name) == (unsigned int)pkt.ipi6_ifindex) in ipv6rs_handledata()
349 if (ifp == NULL) { in ipv6rs_handledata()
354 for (rap = ifp->ras; rap; rap = rap->next) { in ipv6rs_handledata()
371 ifp->name, sfrom); in ipv6rs_handledata()
376 rap->next = ifp->ras; in ipv6rs_handledata()
378 ifp->ras = rap; in ipv6rs_handledata()
402 syslog(LOG_ERR, "%s: Short option", ifp->name); in ipv6rs_handledata()
408 syslog(LOG_ERR, "%s: zero length option", ifp->name); in ipv6rs_handledata()
413 "%s: Option length exceeds message", ifp->name); in ipv6rs_handledata()
424 ifp->name); in ipv6rs_handledata()
429 ifp->name); in ipv6rs_handledata()
436 "%s: invalid prefix in RA", ifp->name); in ipv6rs_handledata()
473 ifp->name); in ipv6rs_handledata()
500 ifp->name); in ipv6rs_handledata()
547 ipv6rs_sort(ifp); in ipv6rs_handledata()
548 run_script_reason(ifp, options & DHCPCD_TEST ? "TEST" : "ROUTERADVERT"); in ipv6rs_handledata()
553 if (!(ifp->state->options->options & DHCPCD_IPV6RA_REQRDNSS)) in ipv6rs_handledata()
558 delete_timeout(NULL, ifp); in ipv6rs_handledata()
559 ipv6rs_expire(ifp); in ipv6rs_handledata()
565 ifp->name); in ipv6rs_handledata()
569 ipv6rs_env(char **env, const char *prefix, const struct interface *ifp) in ipv6rs_env() argument
581 for (rap = ifp->ras, i = 1; rap; rap = rap->next, i++) { in ipv6rs_env()
665 ipv6rs_free(struct interface *ifp) in ipv6rs_free() argument
669 free(ifp->rs); in ipv6rs_free()
670 ifp->rs = NULL; in ipv6rs_free()
671 for (rap = ifp->ras; rap && (ran = rap->next, 1); rap = ran) { in ipv6rs_free()
676 ifp->ras = NULL; in ipv6rs_free()
682 struct interface *ifp; in ipv6rs_expire() local
689 ifp = arg; in ipv6rs_expire()
695 for (rap = ifp->ras, ral = NULL; in ipv6rs_expire()
704 ifp->name, rap->sfrom); in ipv6rs_expire()
709 ifp->ras = ran; in ipv6rs_expire()
727 ifp->name, rap->sfrom, rao->type); in ipv6rs_expire()
742 add_timeout_tv(&next, ipv6rs_expire, ifp); in ipv6rs_expire()
744 run_script_reason(ifp, "ROUTERADVERT"); in ipv6rs_expire()
748 ipv6rs_start(struct interface *ifp) in ipv6rs_start() argument
751 delete_timeout(NULL, ifp); in ipv6rs_start()
755 ipv6rs_makeprobe(ifp); in ipv6rs_start()
756 if (ifp->rs == NULL) in ipv6rs_start()
759 ifp->rsprobes = 0; in ipv6rs_start()
760 ipv6rs_sendprobe(ifp); in ipv6rs_start()