Lines Matching refs:ifp
223 make_env(const struct interface *ifp, const char *reason, char ***argv)
230 const struct if_options *ifo = ifp->options;
243 state = D_STATE(ifp);
247 d6_state = D6_CSTATE(ifp);
254 else if (ipv6nd_hasra(ifp))
284 if (ifp->ctx->options & DHCPCD_DUMPLEASE)
294 e = strlen("interface") + strlen(ifp->name) + 2;
296 snprintf(env[0], e, "interface=%s", ifp->name);
300 if (ifp->ctx->options & DHCPCD_DUMPLEASE)
307 ifp->carrier == LINK_UNKNOWN ? "unknown" :
308 ifp->carrier == LINK_UP ? "up" : "down");
310 snprintf(env[4], e, "ifmetric=%d", ifp->metric);
312 snprintf(env[5], e, "ifwireless=%d", ifp->wireless);
314 snprintf(env[6], e, "ifflags=%u", ifp->flags);
316 snprintf(env[7], e, "ifmtu=%d", if_getmtu(ifp->name));
318 TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
327 TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
356 || (ra && ipv6nd_hasra(ifp))
368 if (dhcpcd_oneup(ifp->ctx))
374 if (dhcpcd_ipwaited(ifp->ctx))
385 if (*ifp->profile) {
386 e = strlen("profile=") + strlen(ifp->profile) + 1;
388 snprintf(env[elen++], e, "profile=%s", ifp->profile);
390 if (ifp->wireless) {
397 (const uint8_t *)ifp->ssid, ifp->ssid_len);
403 (const uint8_t *)ifp->ssid, ifp->ssid_len);
409 n = dhcp_env(NULL, NULL, state->old, ifp);
418 n = dhcp_env(env + elen, "old", state->old, ifp);
423 if (append_config(ifp->ctx, &env, &elen, "old",
440 n = dhcp6_env(NULL, NULL, ifp,
448 n = dhcp6_env(env + elen, "old", ifp,
460 n = dhcp_env(NULL, NULL, state->new, ifp);
468 state->new, ifp);
473 if (append_config(ifp->ctx, &env, &elen, "new",
479 if (dhcp6 && D6_STATE_RUNNING(ifp)) {
480 n = dhcp6_env(NULL, NULL, ifp,
488 n = dhcp6_env(env + elen, "new", ifp,
496 n = ipv6nd_env(NULL, NULL, ifp);
503 n = ipv6nd_env(env + elen, NULL, ifp);
535 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
570 send_interface(struct fd_list *fd, const struct interface *ifp)
581 switch (ifp->carrier) {
592 if (send_interface1(fd, ifp, reason) == -1)
595 if (D_STATE_RUNNING(ifp)) {
596 d = D_CSTATE(ifp);
597 if (send_interface1(fd, ifp, d->reason) == -1)
603 if (RS_STATE_RUNNING(ifp)) {
604 if (send_interface1(fd, ifp, "ROUTERADVERT") == -1)
607 if (D6_STATE_RUNNING(ifp)) {
608 d6 = D6_CSTATE(ifp);
609 if (send_interface1(fd, ifp, d6->reason) == -1)
618 script_runreason(const struct interface *ifp, const char *reason)
628 if (ifp->options->script &&
629 (ifp->options->script[0] == '\0' ||
630 strcmp(ifp->options->script, "/dev/null") == 0))
633 argv[0] = ifp->options->script ? ifp->options->script : UNCONST(SCRIPT);
635 logger(ifp->ctx, LOG_DEBUG, "%s: executing `%s' %s",
636 ifp->name, argv[0], reason);
639 elen = (size_t)make_env(ifp, reason, &env);
641 logger(ifp->ctx, LOG_ERR, "%s: make_env: %m", ifp->name);
680 pid = exec_script(ifp->ctx, argv, env);
682 logger(ifp->ctx, LOG_ERR, "%s: %s: %m", __func__, argv[0]);
687 logger(ifp->ctx, LOG_ERR, "waitpid: %m");
694 logger(ifp->ctx, LOG_ERR,
698 logger(ifp->ctx, LOG_ERR, "%s: %s: %s",
705 TAILQ_FOREACH(fd, &ifp->ctx->control_fds, next) {
712 logger(ifp->ctx, LOG_ERR, "%s: arraytostr: %m",
713 ifp->name);
718 logger(ifp->ctx, LOG_ERR,