Home | History | Annotate | Download | only in dhcpcd

Lines Matching refs:iface

166 make_env(const struct interface *iface, const char *reason, char ***argv)
170 const struct if_options *ifo = iface->state->options;
189 e = strlen("interface") + strlen(iface->name) + 2;
191 snprintf(env[0], e, "interface=%s", iface->name);
202 snprintf(env[3], e, "ifmetric=%d", iface->metric);
204 snprintf(env[4], e, "ifwireless=%d", iface->wireless);
206 snprintf(env[5], e, "ifflags=%u", iface->flags);
208 snprintf(env[6], e, "ifmtu=%d", get_mtu(iface->name));
224 if ((dhcp && iface->state->new) || (ra && iface->ras)) {
231 if (*iface->state->profile) {
232 e = strlen("profile=") + strlen(iface->state->profile) + 2;
234 snprintf(env[elen++], e, "profile=%s", iface->state->profile);
236 if (iface->wireless) {
237 e = strlen("new_ssid=") + strlen(iface->ssid) + 2;
238 if (iface->state->new != NULL ||
239 strcmp(iface->state->reason, "CARRIER") == 0)
243 snprintf(env[elen++], e, "new_ssid=%s", iface->ssid);
245 if (iface->state->old != NULL ||
246 strcmp(iface->state->reason, "NOCARRIER") == 0)
250 snprintf(env[elen++], e, "old_ssid=%s", iface->ssid);
253 if (dhcp && iface->state->old) {
254 e = configure_env(NULL, NULL, iface->state->old, ifo);
258 iface->state->old, ifo);
265 if (dhcp && iface->state->new) {
266 e = configure_env(NULL, NULL, iface->state->new, ifo);
270 iface->state->new, ifo);
276 e = ipv6rs_env(NULL, NULL, iface);
279 elen += ipv6rs_env(env + elen, NULL, iface);
303 send_interface1(int fd, const struct interface *iface, const char *reason)
311 make_env(iface, reason, &env);
327 send_interface(int fd, const struct interface *iface)
330 if (send_interface1(fd, iface, iface->state->reason) == -1)
332 if (iface->ras) {
333 if (send_interface1(fd, iface, "ROUTERADVERT") == -1)
340 run_script_reason(const struct interface *iface, const char *reason)
342 char *const argv[2] = { UNCONST(iface->state->options->script), NULL };
351 if (iface->state->options->script == NULL ||
352 iface->state->options->script[0] == '\0' ||
353 strcmp(iface->state->options->script, "/dev/null") == 0)
357 reason = iface->state->reason;
359 iface->name, argv[0], reason);
362 elen = make_env(iface, reason, &env);
425 (srt || (!rt->iface ||
426 rt->iface->metric == r->iface->metric)) &&
441 const char *ifname = rt->iface->name;
484 !(rt->iface->state->options->options & DHCPCD_GATEWAY))
493 (rt->iface->addr.s_addr & rt->iface->net.s_addr) &&
494 rt->net.s_addr == rt->iface->net.s_addr &&
500 syslog(LOG_ERR, "%s: add_route: %m", rt->iface->name);
510 !(nrt->iface->state->options->options & DHCPCD_GATEWAY))
520 syslog(LOG_ERR, "%s: add_route: %m", nrt->iface->name);
532 syslog(LOG_ERR,"%s: del_route: %m", rt->iface->name);
559 add_subnet_route(struct rt *rt, const struct interface *iface)
563 if (iface->net.s_addr == INADDR_BROADCAST ||
564 iface->net.s_addr == INADDR_ANY ||
565 (iface->state->options->options &
567 iface->state->options->req_addr.s_addr == INADDR_ANY))
571 r->dest.s_addr = iface->addr.s_addr & iface->net.s_addr;
572 r->net.s_addr = iface->net.s_addr;
579 get_routes(const struct interface *iface)
583 if (iface->state->options->routes != NULL) {
584 for (rt = iface->state->options->routes;
602 return get_option_routes(iface->state->new,
603 iface->name, &iface->state->options->options);
610 massage_host_routes(struct rt *rt, const struct interface *iface)
615 if (r->gate.s_addr == iface->addr.s_addr &&
622 add_destination_route(struct rt *rt, const struct interface *iface)
626 if (!(iface->flags & IFF_POINTOPOINT) ||
627 !has_option_mask(iface->state->options->dstmask, DHO_ROUTER))
632 r->gate.s_addr = iface->dst.s_addr;
706 rt->iface = ifp;
714 if (or->iface != ifp ||
753 delete_address(struct interface *iface)
758 ifo = iface->state->options;
763 iface->name,
764 inet_ntoa(iface->addr),
765 inet_ntocidr(iface->net));
766 retval = del_address(iface, &iface->addr, &iface->net);
769 iface->addr.s_addr = 0;
770 iface->net.s_addr = 0;
775 configure(struct interface *iface)
777 struct dhcp_message *dhcp = iface->state->new;
778 struct dhcp_lease *lease = &iface->state->lease;
779 struct if_options *ifo = iface->state->options;
789 if (iface->addr.s_addr != 0)
790 delete_address(iface);
791 run_script(iface);
798 !has_address(iface->name, &lease->addr, &lease->net))
801 iface->name, inet_ntoa(lease->addr),
803 if (add_address(iface,
813 if (iface->addr.s_addr != lease->addr.s_addr &&
814 iface->addr.s_addr != 0)
815 delete_address(iface);
817 iface->addr.s_addr = lease->addr.s_addr;
818 iface->net.s_addr = lease->net.s_addr;
825 rt->iface = iface;
835 if (!iface->state->lease.frominfo &&
837 if (write_lease(iface, dhcp) == -1)
839 run_script(iface);