• Home
  • Raw
  • Download

Lines Matching refs:iface

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