Lines Matching defs:ifi

350 			struct ifinfo *ifi;
357 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
358 if (ifi->state != IFS_DOWN && ifi->racnt == 0)
361 if (ifi == NULL)
399 struct ifinfo *ifi;
441 if ((ifi = malloc(sizeof(*ifi))) == NULL) {
446 memset(ifi, 0, sizeof(*ifi));
447 ifi->sdl = sdl;
448 ifi->ifi_rdnss = IFI_DNSOPT_STATE_NOINFO;
449 ifi->ifi_dnssl = IFI_DNSOPT_STATE_NOINFO;
450 TAILQ_INIT(&ifi->ifi_rainfo);
451 strlcpy(ifi->ifname, ifname, sizeof(ifi->ifname));
454 if (make_packet(ifi))
459 if (inet_zoneid(AF_INET6, 2, ifname, &ifi->linkid))
463 ifi->linkid = ifi->sdl->sdl_index;
470 ifi->mediareqok = 1;
471 ifi->active = interface_status(ifi);
472 if (!ifi->mediareqok) {
477 ifi->probeinterval = PROBE_INTERVAL;
481 flags = interface_up(ifi->ifname);
483 ifi->state = IFS_DELAY;
485 ifi->state = IFS_TENTATIVE;
487 ifi->state = IFS_DOWN;
489 rtsol_timer_update(ifi);
491 TAILQ_INSERT_TAIL(&ifinfo_head, ifi, ifi_next);
495 free(ifi->sdl);
496 free(ifi);
503 struct ifinfo *ifi;
505 while ((ifi = TAILQ_FIRST(&ifinfo_head)) != NULL) {
506 TAILQ_REMOVE(&ifinfo_head, ifi, ifi_next);
507 if (ifi->sdl != NULL)
508 free(ifi->sdl);
509 if (ifi->rs_data != NULL)
510 free(ifi->rs_data);
511 free(ifi);
519 struct ifinfo *ifi, *prev;
523 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
524 if (strncmp(ifi->ifname, ifname, sizeof(ifi->ifname)) == 0)
526 prev = ifi;
528 prev->next = ifi->next;
532 /* reclaim it after ifconfig() in case ifname is pointer inside ifi */
533 if (ifi->rs_data)
534 free(ifi->rs_data);
535 free(ifi->sdl);
536 free(ifi);
543 find_rainfo(struct ifinfo *ifi, struct sockaddr_in6 *sin6)
547 TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next)
558 struct ifinfo *ifi;
560 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
561 if (ifi->sdl->sdl_index == ifindex)
562 return (ifi);
568 make_packet(struct ifinfo *ifi)
574 if ((lladdroptlen = lladdropt_length(ifi->sdl)) == 0) {
577 " on %s. Treat as not included.", ifi->ifname);
580 ifi->rs_datalen = packlen;
585 "memory allocation failed for %s", ifi->ifname);
588 ifi->rs_data = buf;
600 lladdropt_fill(ifi->sdl, (struct nd_opt_hdr *)buf);
610 struct ifinfo *ifi;
619 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
620 if (TS_CMP(&ifi->expire, &now, <=)) {
622 "state = %d", ifi->ifname, ifi->state);
624 while((rai = TAILQ_FIRST(&ifi->ifi_rainfo)) != NULL) {
626 TAILQ_REMOVE(&ifi->ifi_rainfo, rai, rai_next);
637 switch (ifi->state) {
641 flags = interface_up(ifi->ifname);
643 ifi->state = IFS_DELAY;
645 ifi->state = IFS_TENTATIVE;
647 ifi->state = IFS_DOWN;
651 int oldstatus = ifi->active;
654 ifi->active = interface_status(ifi);
656 if (oldstatus != ifi->active) {
660 ifi->ifname,
661 oldstatus, ifi->active);
663 ifi->state = IFS_DELAY;
664 } else if (ifi->probeinterval &&
665 (ifi->probetimer -=
666 ifi->timer.tv_sec) <= 0) {
668 ifi->probetimer =
669 ifi->probeinterval;
671 ifi->state = IFS_PROBE;
679 ifi->otherconfig = 0;
682 defrouter_probe(ifi);
686 ifi->state = IFS_PROBE;
687 sendpacket(ifi);
690 if (ifi->probes < MAX_RTR_SOLICITATIONS)
691 sendpacket(ifi);
695 ifi->probes);
696 ifi->probes = 0;
697 ifi->state = IFS_IDLE;
701 rtsol_timer_update(ifi);
706 TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) {
729 ra_opt_handler(ifi);
731 if (TS_CMP(&ifi->expire, &rtsol_timer, <))
732 rtsol_timer = ifi->expire;
753 rtsol_timer_update(struct ifinfo *ifi)
760 bzero(&ifi->timer, sizeof(ifi->timer));
762 switch (ifi->state) {
765 if (++ifi->dadcount > DADRETRY) {
766 ifi->dadcount = 0;
767 ifi->timer.tv_sec = PROBE_INTERVAL;
769 ifi->timer.tv_sec = 1;
774 ifi->timer.tv_sec = 3;
777 ifi->timer = tm_max; /* stop timer(valid?) */
781 ifi->timer.tv_sec = interval / MILLION;
782 ifi->timer.tv_nsec = (interval % MILLION) * 1000;
785 if (ifi->probes < MAX_RTR_SOLICITATIONS)
786 ifi->timer.tv_sec = RTR_SOLICITATION_INTERVAL;
795 ifi->timer.tv_sec = MAX_RTR_SOLICITATION_DELAY;
801 ifi->state, ifi->ifname);
806 if (TS_CMP(&ifi->timer, &tm_max, ==)) {
807 ifi->expire = tm_max;
809 "stop timer for %s", ifi->ifname);
812 TS_ADD(&now, &ifi->timer, &ifi->expire);
814 now.tv_sec += ifi->timer.tv_sec;
815 now.tv_nsec += ifi->timer.tv_nsec;
817 ifi->ifname, sec2str(&now));