Lines Matching refs:ifp
106 if_free(struct interface *ifp)
109 if (ifp == NULL)
111 ipv4_free(ifp);
112 dhcp_free(ifp);
113 dhcp6_free(ifp);
114 ipv6nd_free(ifp);
115 ipv6_free(ifp);
116 free_options(ifp->options);
117 free(ifp);
155 if_setflag(struct interface *ifp, short flag)
163 strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
173 ifp->flags = (unsigned int)ifr.ifr_flags;
195 struct interface *ifp;
208 if ((ifp = if_find(ifs, ifa->ifa_name)) == NULL)
222 ifa_flags = if_addrflags(&addr->sin_addr, ifp);
239 ifa_flags = if_addrflags6(&sin6->sin6_addr, ifp);
259 struct interface *ifp;
315 TAILQ_FOREACH(ifp, ifs, next) {
316 if (strcmp(ifp->name, ifa->ifa_name) == 0)
319 if (ifp)
384 ifp = calloc(1, sizeof(*ifp));
385 if (ifp == NULL) {
389 ifp->ctx = ctx;
391 strlcpy(ifp->alias, alias, sizeof(ifp->alias));
393 strlcpy(ifp->name, p, sizeof(ifp->name));
395 strlcpy(ifp->lease_identifier, lease_identifier,
396 sizeof(ifp->lease_identifier));
398 ifp->flags = ifa->ifa_flags;
399 ifp->carrier = if_carrier(ifp);
407 strlcpy(iflr.iflr_name, ifp->name,
416 if_free(ifp);
421 ifp->index = sdl->sdl_index;
436 !if_hasconf(ctx, ifp->name))
438 logger(ifp->ctx, LOG_DEBUG,
442 ifp->name);
443 if_free(ifp);
455 ifp->family = ARPHRD_ETHER;
459 ifp->family = ARPHRD_IEEE1394;
464 ifp->family = ARPHRD_INFINIBAND;
471 !if_hasconf(ctx, ifp->name))
473 if_free(ifp);
476 logger(ifp->ctx, LOG_WARNING,
478 ifp->name, sdl->sdl_type);
480 ifp->family = ARPHRD_ETHER;
483 ifp->hwlen = sdl->sdl_alen;
487 memcpy(ifp->hwaddr, CLLADDR(sdl), ifp->hwlen);
490 ifp->index = (unsigned int)sll->sll_ifindex;
491 ifp->family = sll->sll_hatype;
492 ifp->hwlen = sll->sll_halen;
493 if (ifp->hwlen != 0)
494 memcpy(ifp->hwaddr, sll->sll_addr, ifp->hwlen);
500 ifp->index = if_nametoindex(ifp->name);
504 if (ifp->family != ARPHRD_ETHER) {
506 ctx->ifac == 0 && !if_hasconf(ctx, ifp->name))
508 if_free(ifp);
511 switch (ifp->family) {
526 logger(ifp->ctx, LOG_WARNING,
528 ifp->name, ifp->family);
535 if (if_init(ifp) == -1) {
536 logger(ifp->ctx, LOG_ERR, "%s: if_init: %m", p);
537 if_free(ifp);
542 if (if_getmtu(ifp->name) < MTU_MIN &&
543 if_setmtu(ifp->name, MTU_MIN) == -1)
545 logger(ifp->ctx, LOG_ERR, "%s: set_mtu: %m", p);
546 if_free(ifp);
553 strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
555 ifp->metric = ifr.ifr_metric;
559 ifp->metric = 200 + ifp->index;
560 if (if_getssid(ifp) != -1) {
561 ifp->wireless = 1;
562 ifp->metric += 100;
566 TAILQ_INSERT_TAIL(ifs, ifp, next);
595 struct interface *ifp;
597 TAILQ_FOREACH(ifp, ifaces, next) {
598 if ((ifp->options == NULL ||
599 !(ifp->options->options & DHCPCD_PFXDLGONLY)) &&
600 ((name && strcmp(ifp->name, name) == 0) ||
602 (name && strcmp(ifp->alias, name) == 0) ||
604 (!name && ifp->index == idx)))
605 return ifp;
699 struct interface *ifp, *ift;
702 (ifp = TAILQ_FIRST(ctx->ifaces)) == NULL ||
703 TAILQ_NEXT(ifp, next) == NULL)
707 TAILQ_REMOVE(ctx->ifaces, ifp, next);
708 TAILQ_INSERT_HEAD(&sorted, ifp, next);
709 while ((ifp = TAILQ_FIRST(ctx->ifaces))) {
710 TAILQ_REMOVE(ctx->ifaces, ifp, next);
712 if (if_cmp(ifp, ift) == -1) {
713 TAILQ_INSERT_BEFORE(ift, ifp, next);
718 TAILQ_INSERT_TAIL(&sorted, ifp, next);