Lines Matching defs:ifcp

278 	struct	ifc *ifcp;
403 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
404 if (ifcp->ifc_index < 0) {
406 "(no link-local address?)\n", ifcp->ifc_name);
416 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
417 ifrt(ifcp, 0);
456 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
457 if (iff_find(ifcp, IFIL_TYPE_N) != NULL)
459 if (ifcp->ifc_index > 0 && (ifcp->ifc_flags & IFF_UP))
460 sendrequest(ifcp);
577 struct ifc *ifcp;
595 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
596 if (ifcp->ifc_index > 0 && (ifcp->ifc_flags & IFF_UP))
597 ripsend(ifcp, &ifcp->ifc_ripsin, 0);
753 ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np)
758 if (ifcp)
760 ifcp->ifc_name, nrt,
790 if (ifcp != NULL) {
793 ifcp->ifc_name,
794 inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
796 ifcp->ifc_flags &= ~IFF_UP;
808 ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag)
819 if (ifcp == NULL) {
850 (qflag || (ifcp->ifc_flags & IFF_LOOPBACK)))
854 if (iff_find(ifcp, IFIL_TYPE_N) != NULL)
858 if (iff_find(ifcp, IFIL_TYPE_T) != NULL) {
864 rrt_info.rip6_metric += ifcp->ifc_metric;
869 ripflush(ifcp, sin6, nrt, np);
873 maxrte = (ifcp->ifc_mtu - sizeof(struct ip6_hdr) -
884 if (out_filter(rrt, ifcp) == 0)
888 if (tobeadv(rrt, ifcp) == 0)
897 if (rrt->rrt_index == ifcp->ifc_index &&
902 ripflush(ifcp, sin6, nrt, np);
915 } else if (nh && (rrt->rrt_index != ifcp->ifc_index ||
920 ripflush(ifcp, sin6, nrt, np);
935 ripflush(ifcp, sin6, nrt, np);
942 ripflush(ifcp, sin6, nrt, np);
949 out_filter(struct riprt *rrt, struct ifc *ifcp)
959 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
976 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
993 if (iff_find(ifcp, IFIL_TYPE_O) != NULL) {
995 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
1020 tobeadv(struct riprt *rrt, struct ifc *ifcp)
1031 if (sflag && rrt->rrt_index != ifcp->ifc_index)
1036 if (hflag == 0 && rrt->rrt_index == ifcp->ifc_index)
1104 struct ifc *ifcp, *ic;
1197 ifcp = index2ifc[idx];
1198 riprequest(ifcp, np, nn, &fsock);
1243 ifcp = (idx < nindex2ifc) ? index2ifc[idx] : NULL;
1244 if (!ifcp) {
1248 if (IN6_ARE_ADDR_EQUAL(&ifcp->ifc_mylladdr, &fsock.sin6_addr))
1256 if (iff_find(ifcp, IFIL_TYPE_N) != NULL)
1260 ifcp->ifc_name, inet6_n2p(&nh), ntohs(fsock.sin6_port), nn);
1321 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
1344 np->rip6_metric += ifcp->ifc_metric;
1354 if (rrt->rrt_index == ifcp->ifc_index &&
1360 rrt->rrt_index = ifcp->ifc_index;
1365 addroute(rrt, &nh, ifcp);
1371 rrt->rrt_index == ifcp->ifc_index &&
1380 if (rrt->rrt_index == ifcp->ifc_index &&
1386 rrt->rrt_index = ifcp->ifc_index;
1391 addroute(rrt, &nh, ifcp);
1410 rrt->rrt_index = ifcp->ifc_index;
1419 addroute(rrt, &nh, ifcp);
1432 if (ifcp->ifc_index == ic->ifc_index)
1450 sendrequest(struct ifc *ifcp)
1455 if (ifcp->ifc_flags & IFF_LOOPBACK)
1462 ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
1463 error = sendpacket(&ifcp->ifc_ripsin, RIPSIZE(1));
1468 ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
1469 ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */
1478 riprequest(struct ifc *ifcp,
1502 ripsend(ifcp, sin6, RRTF_SENDANYWAY);
1512 struct ifc *ifcp;
1529 ifcp = ifc_find(ifa->ifa_name);
1533 if (!ifcp) {
1535 if ((ifcp = MALLOC(struct ifc)) == NULL) {
1539 memset(ifcp, 0, sizeof(*ifcp));
1541 ifcp->ifc_index = -1;
1542 strlcpy(ifcp->ifc_name, ifa->ifa_name,
1543 sizeof(ifcp->ifc_name));
1544 TAILQ_INIT(&ifcp->ifc_ifac_head);
1545 TAILQ_INIT(&ifcp->ifc_iff_head);
1546 ifcp->ifc_flags = ifa->ifa_flags;
1547 TAILQ_INSERT_HEAD(&ifc_head, ifcp, ifc_next);
1548 trace(1, "newif %s <%s>\n", ifcp->ifc_name,
1549 ifflags(ifcp->ifc_flags));
1550 if (!strcmp(ifcp->ifc_name, LOOPBACK_IF))
1551 loopifcp = ifcp;
1554 if (ifcp->ifc_flags != ifa->ifa_flags) {
1555 trace(1, "%s: <%s> -> ", ifcp->ifc_name,
1556 ifflags(ifcp->ifc_flags));
1558 ifcp->ifc_cflags |= IFC_CHANGED;
1560 ifcp->ifc_flags = ifa->ifa_flags;
1562 if (ifconfig1(ifa->ifa_name, ifa->ifa_addr, ifcp, s) < 0) {
1566 if ((ifcp->ifc_flags & (IFF_LOOPBACK | IFF_UP)) == IFF_UP
1567 && 0 < ifcp->ifc_index && !ifcp->ifc_joined) {
1568 mreq.ipv6mr_multiaddr = ifcp->ifc_ripsin.sin6_addr;
1569 mreq.ipv6mr_interface = ifcp->ifc_index;
1575 trace(1, "join %s %s\n", ifcp->ifc_name, RIP6_DEST);
1576 ifcp->ifc_joined++;
1586 struct ifc *ifcp,
1605 if ((ifac = ifa_match(ifcp, &sin6->sin6_addr, plen)) != NULL) {
1620 ifac->ifac_ifc = ifcp;
1624 if (ifcp->ifc_flags & IFF_POINTOPOINT) {
1639 if (ifcp->ifc_index < 0 && IN6_IS_ADDR_LINKLOCAL(&ifac->ifac_addr)) {
1640 ifcp->ifc_mylladdr = ifac->ifac_addr;
1641 ifcp->ifc_index = ifac->ifac_scope_id;
1642 memcpy(&ifcp->ifc_ripsin, &ripsin, ripsin.ss_len);
1643 ifcp->ifc_ripsin.sin6_scope_id = ifcp->ifc_index;
1644 setindex2ifc(ifcp->ifc_index, ifcp);
1645 ifcp->ifc_mtu = getifmtu(ifcp->ifc_index);
1646 if (ifcp->ifc_mtu > RIP6_MAXMTU)
1647 ifcp->ifc_mtu = RIP6_MAXMTU;
1652 ifcp->ifc_metric = ifr.ifr_metric;
1654 ifcp->ifc_index, ifcp->ifc_mtu, ifcp->ifc_metric);
1656 ifcp->ifc_cflags |= IFC_CHANGED;
1658 TAILQ_INSERT_HEAD(&ifcp->ifc_ifac_head, ifac, ifac_next);
1666 struct ifc *ifcp;
1669 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
1670 if (ifcp->ifc_index == ifindex)
1673 if (ifcp == NULL)
1676 tracet(1, "ifremove: %s is departed.\n", ifcp->ifc_name);
1677 TAILQ_REMOVE(&ifc_head, ifcp, ifc_next);
1680 if (rrt->rrt_index == ifcp->ifc_index &&
1684 free(ifcp);
1701 struct ifc *ifcp, *ic;
1904 ifcp = index2ifc[ifam->ifam_index];
1906 ifcp = NULL;
1907 if (!ifcp) {
1912 if (!rt_deladdr(ifcp, rta[RTAX_IFA], rta[RTAX_NETMASK]))
1922 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
1923 if (ifcp->ifc_cflags & IFC_CHANGED) {
1924 if (ifrt(ifcp, 1)) {
1926 if (ifcp->ifc_index == ic->ifc_index)
1937 ifcp->ifc_cflags &= ~IFC_CHANGED;
2049 rt_deladdr(struct ifc *ifcp,
2069 inet6_n2p(addr), prefix, ifcp->ifc_name);
2070 ifac = ifa_match(ifcp, addr, prefix);
2073 inet6_n2p(addr), prefix, ifcp->ifc_name);
2076 if (ifac->ifac_ifc != ifcp) {
2079 ifcp->ifc_name, ifac->ifac_ifc->ifc_name);
2082 TAILQ_REMOVE(&ifcp->ifc_ifac_head, ifac, ifac_next);
2090 inet6_n2p(&ni6.rip6_dest), ni6.rip6_plen, ifcp->ifc_index);
2094 if (rrt->rrt_index == ifcp->ifc_index &&
2112 if (ifcp->ifc_flags & IFF_POINTOPOINT) {
2119 ifcp->ifc_index);
2121 if (rrt->rrt_index == ifcp->ifc_index &&
2150 ifrt(struct ifc *ifcp, int again)
2159 if (ifcp->ifc_flags & IFF_LOOPBACK)
2163 if (ifcp->ifc_flags & IFF_POINTOPOINT) {
2164 ifrt_p2p(ifcp, again);
2168 TAILQ_FOREACH(ifac, &ifcp->ifc_ifac_head, ifac_next) {
2173 inet6_n2p(&ifac->ifac_addr), ifcp->ifc_name);
2180 ifcp->ifc_name);
2187 ifcp->ifc_name);
2191 if (ifcp->ifc_flags & IFF_UP) {
2196 rrt->rrt_index = ifcp->ifc_index;
2200 rrt->rrt_info.rip6_metric = 1 + ifcp->ifc_metric;
2217 ifcp->ifc_name);
2230 ifcp->ifc_name);
2232 addroute(rrt, &rrt->rrt_gw, ifcp);
2234 sendrequest(ifcp);
2235 ripsend(ifcp, &ifcp->ifc_ripsin, 0);
2239 if (loop_rrt->rrt_index == ifcp->ifc_index) {
2263 ifrt_p2p(struct ifc *ifcp, int again)
2278 TAILQ_FOREACH(ifac, &ifcp->ifc_ifac_head, ifac_next) {
2349 rrt->rrt_index = ifcp->ifc_index;
2376 "(%s on %s)\n", category, ifcp->ifc_name);
2387 rrt->rrt_info.rip6_metric = 1 + ifcp->ifc_metric;
2395 category, ifcp->ifc_name, noadv);
2406 category, ifcp->ifc_name, noadv);
2414 ifcp->ifc_name, noadv);
2813 struct ifc *ifcp)
2823 inet_ntop(AF_INET6, (void *)&ifcp->ifc_mylladdr, (char *)buf2, sizeof(buf2));
2856 sin6->sin6_scope_id = ifcp->ifc_index;
3020 struct ifc *ifcp;
3031 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next)
3036 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
3037 if ((ifcp->ifc_flags & IFF_UP) == 0)
3039 if (iff_find(ifcp, IFIL_TYPE_N) != NULL)
3041 ifdump0(dump, ifcp);
3045 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
3046 if ((ifcp->ifc_flags & IFF_UP) &&
3047 (iff_find(ifcp, IFIL_TYPE_N) == NULL))
3049 ifdump0(dump, ifcp);
3057 ifdump0(FILE *dump, const struct ifc *ifcp)
3066 ifcp->ifc_name, ifcp->ifc_index, ifflags(ifcp->ifc_flags),
3067 inet6_n2p(&ifcp->ifc_mylladdr),
3068 ifcp->ifc_mtu, ifcp->ifc_metric);
3069 TAILQ_FOREACH(ifac, &ifcp->ifc_ifac_head, ifac_next) {
3070 if (ifcp->ifc_flags & IFF_POINTOPOINT) {
3084 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
3167 struct ifc *ifcp;
3217 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
3218 if (fnmatch(ifname, ifcp->ifc_name, 0) != 0)
3230 TAILQ_INSERT_HEAD(&ifcp->ifc_iff_head, iffp, iff_next);
3293 ifa_match(const struct ifc *ifcp,
3299 TAILQ_FOREACH(ifac, &ifcp->ifc_ifac_head, ifac_next) {
3526 struct ifc *ifcp;
3528 TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) {
3529 if (strcmp(name, ifcp->ifc_name) == 0)
3532 return (ifcp);
3536 iff_find(struct ifc *ifcp, int type)
3540 TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) {
3550 setindex2ifc(int idx, struct ifc *ifcp)
3579 index2ifc[idx] = ifcp;