Lines Matching refs:ifp
228 ipv6nd_makersprobe(struct interface *ifp)
234 state = RS_STATE(ifp);
236 state->rslen = sizeof(*rs) + (size_t)ROUNDUP8(ifp->hwlen + 2);
247 nd->nd_opt_len = (uint8_t)((ROUNDUP8(ifp->hwlen + 2)) >> 3);
248 memcpy(nd + 1, ifp->hwaddr, ifp->hwlen);
255 struct interface *ifp = arg;
262 if (ipv6_linklocal(ifp) == NULL) {
263 logger(ifp->ctx, LOG_DEBUG,
265 ifp->name);
266 ipv6_addlinklocalcallback(ifp, ipv6nd_sendrsprobe, ifp);
275 dst.sin6_scope_id = ifp->index;
277 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
281 state = RS_STATE(ifp);
282 ctx = ifp->ctx->ipv6;
295 pi.ipi6_ifindex = ifp->index;
298 logger(ifp->ctx, LOG_DEBUG,
299 "%s: sending Router Solicitation", ifp->name);
301 logger(ifp->ctx, LOG_ERR,
302 "%s: %s: sendmsg: %m", ifp->name, __func__);
303 ipv6nd_drop(ifp);
304 ifp->options->options &= ~(DHCPCD_IPV6 | DHCPCD_IPV6RS);
309 eloop_timeout_add_sec(ifp->ctx->eloop,
310 RTR_SOLICITATION_INTERVAL, ipv6nd_sendrsprobe, ifp);
312 logger(ifp->ctx, LOG_WARNING,
313 "%s: no IPv6 Routers available", ifp->name);
314 ipv6nd_drop(ifp);
315 dhcp6_drop(ifp, "EXPIRE6");
320 ipv6nd_expire(struct interface *ifp, uint32_t seconds)
327 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
328 if (rap->iface == ifp) {
350 ipv6nd_expirera(ifp);
352 ipv6_buildroutes(ifp->ctx);
449 ipv6nd_free(struct interface *ifp)
456 state = RS_STATE(ifp);
462 ifp->if_data[IF_DATA_IPV6ND] = NULL;
464 TAILQ_FOREACH_SAFE(rap, ifp->ctx->ipv6->ra_routers, next, ran) {
465 if (rap->iface == ifp) {
473 ctx = ifp->ctx;
474 TAILQ_FOREACH(ifp, ctx->ifaces, next) {
475 if (RS_STATE(ifp))
478 if (ifp == NULL) {
580 ifp->name);
595 ipv6nd_dadcompleted(const struct interface *ifp)
600 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
601 if (rap->iface != ifp)
617 struct interface *ifp;
625 ifp = ap->iface;
630 logger(ifp->ctx, LOG_WARNING, "%s: DAD detected %s",
631 ifp->name, ap->saddr);
637 if (ifp->options->options & DHCPCD_SLAACPRIVATE) {
639 ifp->ctx, LOG_ERR,
642 ifp->name);
645 logger(ifp->ctx, LOG_INFO, "%s: deleting address %s",
646 ifp->name, ap->saddr);
649 logger(ifp->ctx, LOG_ERR, "if_deladdress6: %m");
653 ifp, &dadcounter) == -1)
655 logger(ifp->ctx, LOG_ERR,
657 ifp->name);
675 eloop_timeout_add_tv(ifp->ctx->eloop, &tv,
683 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
684 if (rap->iface != ifp)
725 ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp,
764 if (ifp == NULL) {
771 if (!(ifp->options->options & DHCPCD_IPV6RS)) {
773 logger(ifp->ctx, LOG_DEBUG, "%s: unexpected RA from %s",
774 ifp->name, ctx->sfrom);
780 if (ipv6_linklocal(ifp) == NULL) {
782 logger(ifp->ctx, LOG_DEBUG,
784 ifp->name, ctx->sfrom);
789 if (ipv6_iffindaddr(ifp, &ctx->from.sin6_addr)) {
790 logger(ifp->ctx, LOG_DEBUG,
791 "%s: ignoring RA from ourself %s", ifp->name, ctx->sfrom);
796 if (ifp == rap->iface &&
816 if (new_data || ifp->options->options & DHCPCD_DEBUG)
817 logger(ifp->ctx, LOG_INFO, "%s: Router Advertisement from %s",
818 ifp->name, ctx->sfrom);
823 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
826 rap->iface = ifp;
837 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
849 logger(ifp->ctx, LOG_WARNING, "%s: %s router available",
850 ifp->name, rap->sfrom);
862 ipv6_settempstale(ifp);
872 logger(ifp->ctx, LOG_ERR,
873 "%s: short option", ifp->name);
879 logger(ifp->ctx, LOG_ERR,
880 "%s: zero length option", ifp->name);
884 logger(ifp->ctx, LOG_ERR,
885 "%s: option length exceeds message", ifp->name);
894 logger(ifp->ctx, new_data ? LOG_ERR : LOG_DEBUG,
896 ifp->name);
900 logger(ifp->ctx, new_data ? LOG_ERR : LOG_DEBUG,
902 ifp->name);
908 logger(ifp->ctx, new_data ? LOG_ERR : LOG_DEBUG,
909 "%s: invalid prefix in RA", ifp->name);
915 logger(ifp->ctx, new_data ? LOG_ERR : LOG_DEBUG,
916 "%s: pltime > vltime", ifp->name);
944 ipv6_makeaddr(&ap->addr, ifp,
975 if (ipv6_iffindaddr(ifp, &ap->addr) &&
1033 logger(ifp->ctx, LOG_ERR, "%s: invalid MTU %d",
1034 ifp->name, mtuv);
1053 r = ipv6_printaddr(NULL, 0, op, ifp->name);
1068 ifp->name);
1090 logger(ifp->ctx, new_data ? LOG_ERR : LOG_DEBUG,
1092 ifp->name);
1110 logger(ifp->ctx, LOG_ERR,
1122 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
1147 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
1171 add_router(ifp->ctx->ipv6, rap);
1185 if (ifp->ctx->options & DHCPCD_TEST) {
1186 script_runreason(ifp, "TEST");
1191 ipv6_addtempaddrs(ifp, &rap->received);
1197 if_initrt6(ifp);
1199 ipv6_buildroutes(ifp->ctx);
1203 eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
1204 eloop_timeout_delete(ifp->ctx->eloop, NULL, rap); /* reachable timer */
1207 if (!(ifp->options->options & DHCPCD_DHCP6))
1210 if (new_data && dhcp6_start(ifp, DH6S_INIT) == -1)
1211 logger(ifp->ctx, LOG_ERR,
1212 "dhcp6_start: %s: %m", ifp->name);
1214 if (new_data && dhcp6_start(ifp, DH6S_INFORM) == -1)
1215 logger(ifp->ctx, LOG_ERR,
1216 "dhcp6_start: %s: %m", ifp->name);
1219 logger(ifp->ctx, LOG_DEBUG,
1220 "%s: No DHCPv6 instruction in RA", ifp->name);
1222 if (ifp->ctx->options & DHCPCD_TEST) {
1223 eloop_exit(ifp->ctx->eloop, EXIT_SUCCESS);
1229 ipv6nd_expirera(ifp);
1235 ipv6nd_runignoredra(struct interface *ifp)
1239 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
1240 if (rap->iface == ifp &&
1248 if (ifp->ctx->options & DHCPCD_TEST) {
1249 script_runreason(ifp, "TEST");
1254 eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
1255 eloop_timeout_delete(ifp->ctx->eloop, NULL, rap);
1261 ipv6nd_hasra(const struct interface *ifp)
1265 if (ifp->ctx->ipv6) {
1266 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next)
1267 if (rap->iface == ifp && !rap->expired)
1274 ipv6nd_hasradhcp(const struct interface *ifp)
1278 if (ifp->ctx->ipv6) {
1279 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
1280 if (rap->iface == ifp &&
1290 ifp)
1300 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
1301 if (rap->iface != ifp)
1307 setvar(ifp->ctx, &env, prefix, buffer, rap->sfrom);
1349 logger(ifp->ctx, LOG_ERR,
1371 logger(ifp->ctx,
1385 logger(ifp->ctx, LOG_ERR,
1392 setvar(ifp->ctx, &env,
1399 setvard(ifp->ctx, &env, prefix, "ra_count", i);
1422 struct interface *ifp;
1428 ifp = arg;
1434 TAILQ_FOREACH_SAFE(rap, ifp->ctx->ipv6->ra_routers, next, ran) {
1435 if (rap->iface != ifp)
1445 logger(ifp->ctx, LOG_WARNING,
1447 ifp->name, rap->sfrom);
1483 logger(ifp->ctx, LOG_WARNING,
1485 ifp->name, rap->sfrom, rao->type);
1507 eloop_timeout_add_tv(ifp->ctx->eloop,
1508 &next, ipv6nd_expirera, ifp);
1510 ipv6_buildroutes(ifp->ctx);
1511 script_runreason(ifp, "ROUTERADVERT");
1516 dhcp6_drop(ifp, "EXPIRE6");
1520 ipv6nd_drop(struct interface *ifp)
1526 if (ifp->ctx->ipv6 == NULL)
1529 eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
1531 TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
1532 if (rap->iface == ifp) {
1534 TAILQ_REMOVE(ifp->ctx->ipv6->ra_routers, rap, next);
1543 ipv6_buildroutes(ifp->ctx);
1544 if ((ifp->options->options &
1547 script_runreason(ifp, "ROUTERADVERT");
1552 ipv6nd_handlena(struct dhcpcd_ctx *dctx, struct interface *ifp,
1562 if (ifp == NULL) {
1571 logger(ifp->ctx, LOG_ERR, "%s: IPv6 NA too short from %s",
1572 ifp->name, ctx->sfrom);
1583 logger(ifp->ctx, LOG_ERR, "%s: NA multicast address %s (%s)",
1584 ifp->name, taddr, ctx->sfrom);
1589 if (rap->iface == ifp &&
1595 logger(ifp->ctx, LOG_DEBUG, "%s: unexpected NA from %s for %s",
1596 ifp->name, ctx->sfrom, taddr);
1602 logger(ifp->ctx, LOG_DEBUG, "%s: %sNA for %s from %s",
1603 ifp->name, is_solicited ? "solicited " : "", taddr, ctx->sfrom);
1608 logger(ifp->ctx, LOG_INFO, "%s: %s not a router (%s)",
1609 ifp->name, taddr, ctx->sfrom);
1611 ipv6_buildroutes(ifp->ctx);
1612 script_runreason(ifp, "ROUTERADVERT");
1619 logger(ifp->ctx, LOG_INFO, "%s: %s reachable (%s)",
1620 ifp->name, taddr, ctx->sfrom);
1621 ipv6_buildroutes(ifp->ctx);
1637 struct interface *ifp;
1686 TAILQ_FOREACH(ifp, dctx->ifaces, next) {
1687 if (ifp->index == (unsigned int)pkt.ipi6_ifindex &&
1688 !(ifp->options->options & DHCPCD_PFXDLGONLY))
1690 if (!(ifp->options->options & DHCPCD_IPV6))
1700 ipv6nd_handlena(dctx, ifp, icp, (size_t)len);
1703 ipv6nd_handlera(dctx, ifp, icp, (size_t)len);
1715 struct interface *ifp = arg;
1718 logger(ifp->ctx, LOG_INFO, "%s: soliciting an IPv6 router", ifp->name);
1719 if (ipv6nd_open(ifp->ctx) == -1) {
1720 logger(ifp->ctx, LOG_ERR, "%s: ipv6nd_open: %m", __func__);
1724 state = RS_STATE(ifp);
1726 ifp->if_data[IF_DATA_IPV6ND] = calloc(1, sizeof(*state));
1727 state = RS_STATE(ifp);
1729 logger(ifp->ctx, LOG_ERR, "%s: %m", __func__);
1736 ipv6nd_makersprobe(ifp);
1738 logger(ifp->ctx, LOG_ERR,
1744 ipv6nd_sendrsprobe(ifp);
1748 ipv6nd_startrs(struct interface *ifp)
1752 eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
1757 logger(ifp->ctx, LOG_DEBUG,
1759 ifp->name, timespec_to_double(&tv));
1760 eloop_timeout_add_tv(ifp->ctx->eloop, &tv, ipv6nd_startrs1, ifp);