Home | History | Annotate | Download | only in dhcpcd-6.8.2

Lines Matching refs:ifp

114 ipv4_iffindaddr(struct interface *ifp,
120 state = IPV4_STATE(ifp);
132 ipv4_iffindlladdr(struct interface *ifp)
137 state = IPV4_STATE(ifp);
150 struct interface *ifp;
153 TAILQ_FOREACH(ifp, ctx->ifaces, next) {
154 ap = ipv4_iffindaddr(ifp, addr, NULL);
164 struct interface *ifp;
167 TAILQ_FOREACH(ifp, ctx->ifaces, next) {
168 state = D_STATE(ifp);
176 if (addr != NULL && ipv4_iffindaddr(ifp, addr, NULL))
441 add_subnet_route(struct rt_head *rt, const struct interface *ifp)
449 s = D_CSTATE(ifp);
460 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
474 add_loopback_route(struct rt_head *rt, const struct interface *ifp)
482 s = D_CSTATE(ifp);
488 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
501 get_routes(struct interface *ifp)
506 if (ifp->options->routes && TAILQ_FIRST(ifp->options->routes)) {
509 TAILQ_FOREACH(rt, ifp->options->routes, next) {
514 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
524 return get_option_routes(ifp, D_STATE(ifp)->new);
531 massage_host_routes(struct rt_head *rt, const struct interface *ifp)
537 if (r->gate.s_addr == D_CSTATE(ifp)->addr.s_addr ||
550 add_destination_route(struct rt_head *rt, const struct interface *ifp)
555 !(ifp->flags & IFF_POINTOPOINT) ||
556 !has_option_mask(ifp->options->dstmask, DHO_ROUTER))
561 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
567 r->gate.s_addr = D_CSTATE(ifp)->dst.s_addr;
575 add_router_host_route(struct rt_head *rt, const struct interface *ifp)
609 state = D_CSTATE(ifp);
610 ifo = ifp->options;
611 if (ifp->flags & IFF_NOARP) {
616 logger(ifp->ctx, LOG_WARNING,
618 ifp->name, inet_ntoa(rtp->gate));
627 logger(ifp->ctx, LOG_WARNING,
629 ifp->name, inet_ntoa(rtp->gate));
633 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
652 struct interface *ifp;
666 TAILQ_FOREACH(ifp, ctx->ifaces, next) {
667 state = D_CSTATE(ifp);
670 dnr = get_routes(ifp);
671 ifp);
672 dnr = add_subnet_route(dnr, ifp);
674 dnr = add_loopback_route(dnr, ifp);
676 if (ifp->options->options & DHCPCD_GATEWAY) {
677 dnr = add_router_host_route(dnr, ifp);
678 dnr = add_destination_route(dnr, ifp);
683 rt->iface = ifp;
685 rt->metric = ifp->metric;
697 or->iface != ifp ||
743 ipv4_deladdr(struct interface *ifp,
752 logger(ifp->ctx, LOG_DEBUG, "%s: deleting IP address %s/%d",
753 ifp->name, inet_ntoa(*addr), inet_ntocidr(*net));
755 r = if_deladdress(ifp, addr, net);
758 logger(ifp->ctx, LOG_ERR, "%s: %s: %m", ifp->name, __func__);
760 dstate = D_STATE(ifp);
769 state = IPV4_STATE(ifp);
784 delete_address(struct interface *ifp)
790 state = D_STATE(ifp);
791 ifo = ifp->options;
795 r = ipv4_deladdr(ifp, &state->addr, &state->net);
800 ipv4_getstate(struct interface *ifp)
804 state = IPV4_STATE(ifp);
806 ifp->if_data[IF_DATA_IPV4] = malloc(sizeof(*state));
807 state = IPV4_STATE(ifp);
809 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
819 ipv4_addaddr(struct interface *ifp, const struct dhcp_lease *lease)
824 if ((state = ipv4_getstate(ifp)) == NULL) {
825 logger(ifp->ctx, LOG_ERR, "%s: ipv4_getstate: %m", __func__);
828 if (ifp->options->options & DHCPCD_NOALIAS) {
833 ipv4_deladdr(ifp, &ia->addr, &ia->net);
838 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
842 logger(ifp->ctx, LOG_DEBUG, "%s: adding IP address %s/%d",
843 ifp->name, inet_ntoa(lease->addr),
845 if (if_addaddress(ifp, &lease->addr, &lease->net, &lease->brd) == -1) {
847 logger(ifp->ctx, LOG_ERR, "%s: if_addaddress: %m",
853 ia->iface = ifp;
864 ipv4_finalisert(struct interface *ifp)
866 const struct dhcp_state *state = D_CSTATE(ifp);
871 if_initrt(ifp);
872 ipv4_buildroutes(ifp->ctx);
873 script_runreason(ifp, state->reason);
875 dhcpcd_daemonise(ifp->ctx);
879 ipv4_finaliseaddr(struct interface *ifp)
882 struct dhcp_state *state = D_STATE(ifp);
890 ipv4_iffindaddr(ifp, &lease->addr, NULL))
891 delete_address(ifp);
897 ipv4_finalisert(ifp);
907 struct interface *ifp = arg, *ifn;
908 struct dhcp_state *state = D_STATE(ifp), *nstate;
911 struct if_options *ifo = ifp->options;
928 delete_address(ifp);
929 TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
930 if (ifn == ifp ||
931 strcmp(ifn->name, ifp->name) == 0)
951 ipv4_buildroutes(ifp->ctx);
952 script_runreason(ifp, state->reason);
954 ipv4_buildroutes(ifp->ctx);
959 TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
960 if (ifn == ifp || strcmp(ifn->name, ifp->name) == 0)
966 if (ifn->metric <= ifp->metric) {
967 logger(ifp->ctx, LOG_INFO,
969 ifp->name,
974 ipv4_finalisert(ifp);
976 logger(ifp->ctx, LOG_INFO, "%s: preferring %s on %s",
979 ifp->name);
988 TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
989 if (ifn == ifp || strcmp(ifn->name, ifp->name) == 0)
998 ap = ipv4_iffindaddr(ifp, &lease->addr, NULL);
1000 ipv4_deladdr(ifp, &ap->addr, &ap->net);
1002 if (ipv4_iffindaddr(ifp, &lease->addr, &lease->net))
1003 logger(ifp->ctx, LOG_DEBUG,
1005 ifp->name, inet_ntoa(lease->addr),
1008 r = ipv4_addaddr(ifp, lease);
1014 ap = ipv4_iffindaddr(ifp, &lease->addr, NULL);
1016 logger(ifp->ctx, LOG_ERR, "%s: added address vanished",
1017 ifp->name);
1023 ipv4_finaliseaddr(ifp);
1034 struct interface *ifp;
1048 if ((ifp = if_find(ifs, ifname)) == NULL)
1050 if ((state = ipv4_getstate(ifp)) == NULL) {
1055 ap = ipv4_iffindaddr(ifp, addr, net);
1059 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
1062 ap->iface = ifp;
1079 dhcp_handleifa(cmd, ifp, addr, net, dst, flags);
1080 arp_handleifa(cmd, ifp, addr, flags);
1084 ipv4_free(struct interface *ifp)
1089 if (ifp) {
1090 state = IPV4_STATE(ifp);