Lines Matching refs:ifi

307 			struct ifinfo *ifi;
314 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
315 if (ifi->state != IFS_DOWN && ifi->racnt == 0)
318 if (ifi == NULL)
344 struct ifinfo *ifi;
386 if ((ifi = malloc(sizeof(*ifi))) == NULL) {
391 memset(ifi, 0, sizeof(*ifi));
392 ifi->sdl = sdl;
393 ifi->ifi_rdnss = IFI_DNSOPT_STATE_NOINFO;
394 ifi->ifi_dnssl = IFI_DNSOPT_STATE_NOINFO;
395 TAILQ_INIT(&ifi->ifi_rainfo);
396 strlcpy(ifi->ifname, ifname, sizeof(ifi->ifname));
399 if (make_packet(ifi))
404 if (inet_zoneid(AF_INET6, 2, ifname, &ifi->linkid))
408 ifi->linkid = ifi->sdl->sdl_index;
415 ifi->mediareqok = 1;
416 ifi->active = interface_status(ifi);
417 if (!ifi->mediareqok) {
422 ifi->probeinterval = PROBE_INTERVAL;
426 flags = interface_up(ifi->ifname);
428 ifi->state = IFS_DELAY;
430 ifi->state = IFS_TENTATIVE;
432 ifi->state = IFS_DOWN;
434 rtsol_timer_update(ifi);
436 TAILQ_INSERT_TAIL(&ifinfo_head, ifi, ifi_next);
440 free(ifi->sdl);
441 free(ifi);
448 struct ifinfo *ifi;
450 while ((ifi = TAILQ_FIRST(&ifinfo_head)) != NULL) {
451 TAILQ_REMOVE(&ifinfo_head, ifi, ifi_next);
452 if (ifi->sdl != NULL)
453 free(ifi->sdl);
454 if (ifi->rs_data != NULL)
455 free(ifi->rs_data);
456 free(ifi);
464 struct ifinfo *ifi, *prev;
468 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
469 if (strncmp(ifi->ifname, ifname, sizeof(ifi->ifname)) == 0)
471 prev = ifi;
473 prev->next = ifi->next;
477 /* reclaim it after ifconfig() in case ifname is pointer inside ifi */
478 if (ifi->rs_data)
479 free(ifi->rs_data);
480 free(ifi->sdl);
481 free(ifi);
488 find_rainfo(struct ifinfo *ifi, struct sockaddr_in6 *sin6)
492 TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next)
503 struct ifinfo *ifi;
505 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
506 if (ifi->sdl->sdl_index == ifindex)
507 return (ifi);
513 make_packet(struct ifinfo *ifi)
519 if ((lladdroptlen = lladdropt_length(ifi->sdl)) == 0) {
522 " on %s. Treat as not included.", ifi->ifname);
525 ifi->rs_datalen = packlen;
530 "memory allocation failed for %s", ifi->ifname);
533 ifi->rs_data = buf;
545 lladdropt_fill(ifi->sdl, (struct nd_opt_hdr *)buf);
555 struct ifinfo *ifi;
564 TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) {
565 if (TS_CMP(&ifi->expire, &now, <=)) {
567 "state = %d", ifi->ifname, ifi->state);
569 while((rai = TAILQ_FIRST(&ifi->ifi_rainfo)) != NULL) {
571 TAILQ_REMOVE(&ifi->ifi_rainfo, rai, rai_next);
582 switch (ifi->state) {
586 flags = interface_up(ifi->ifname);
588 ifi->state = IFS_DELAY;
590 ifi->state = IFS_TENTATIVE;
592 ifi->state = IFS_DOWN;
596 int oldstatus = ifi->active;
599 ifi->active = interface_status(ifi);
601 if (oldstatus != ifi->active) {
605 ifi->ifname,
606 oldstatus, ifi->active);
608 ifi->state = IFS_DELAY;
609 } else if (ifi->probeinterval &&
610 (ifi->probetimer -=
611 ifi->timer.tv_sec) <= 0) {
613 ifi->probetimer =
614 ifi->probeinterval;
616 ifi->state = IFS_PROBE;
624 ifi->otherconfig = 0;
627 defrouter_probe(ifi);
631 ifi->state = IFS_PROBE;
632 sendpacket(ifi);
635 if (ifi->probes < MAX_RTR_SOLICITATIONS)
636 sendpacket(ifi);
640 ifi->probes);
641 ifi->probes = 0;
642 ifi->state = IFS_IDLE;
646 rtsol_timer_update(ifi);
651 TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) {
674 ra_opt_handler(ifi);
676 if (TS_CMP(&ifi->expire, &rtsol_timer, <))
677 rtsol_timer = ifi->expire;
698 rtsol_timer_update(struct ifinfo *ifi)
705 bzero(&ifi->timer, sizeof(ifi->timer));
707 switch (ifi->state) {
710 if (++ifi->dadcount > DADRETRY) {
711 ifi->dadcount = 0;
712 ifi->timer.tv_sec = PROBE_INTERVAL;
714 ifi->timer.tv_sec = 1;
719 ifi->timer.tv_sec = 3;
722 ifi->timer = tm_max; /* stop timer(valid?) */
726 ifi->timer.tv_sec = interval / MILLION;
727 ifi->timer.tv_nsec = (interval % MILLION) * 1000;
730 if (ifi->probes < MAX_RTR_SOLICITATIONS)
731 ifi->timer.tv_sec = RTR_SOLICITATION_INTERVAL;
740 ifi->timer.tv_sec = MAX_RTR_SOLICITATION_DELAY;
746 ifi->state, ifi->ifname);
751 if (TS_CMP(&ifi->timer, &tm_max, ==)) {
752 ifi->expire = tm_max;
754 "stop timer for %s", ifi->ifname);
757 TS_ADD(&now, &ifi->timer, &ifi->expire);
759 now.tv_sec += ifi->timer.tv_sec;
760 now.tv_nsec += ifi->timer.tv_nsec;
762 ifi->ifname, sec2str(&now));