Lines Matching refs:gt
49 static void prun_add_ttls(struct gtable *gt);
53 static void expire_prune(vifi_t vifi, struct gtable *gt);
54 static void send_prune(struct gtable *gt);
55 static void send_graft(struct gtable *gt);
65 prun_add_ttls(struct gtable *gt)
71 if (VIFM_ISSET(vifi, gt->gt_grpmems))
72 gt->gt_ttls[vifi] = v->uv_threshold;
74 gt->gt_ttls[vifi] = 0;
81 #define GET_SCOPE(gt) { \
83 if ((ntohl((gt)->gt_mcastgrp) & 0xff000000) == 0xef000000) \
85 if (scoped_addr(_i, (gt)->gt_mcastgrp)) \
86 VIFM_SET(_i, (gt)->gt_scope); \
132 struct gtable *gt;
135 gt = kernel_table;
136 while (gt != NULL) {
137 if (grp == gt->gt_mcastgrp &&
138 (mask ? (gt->gt_route->rt_origin == src &&
139 gt->gt_route->rt_originmask == mask) :
140 ((src & gt->gt_route->rt_originmask) ==
141 gt->gt_route->rt_origin)))
143 if (ntohl(grp) > ntohl(gt->gt_mcastgrp) ||
144 (grp == gt->gt_mcastgrp &&
145 (ntohl(mask) < ntohl(gt->gt_route->rt_originmask) ||
146 (mask == gt->gt_route->rt_originmask &&
147 (ntohl(src) > ntohl(gt->gt_route->rt_origin)))))) {
148 gtp = gt;
149 gt = gt->gt_gnext;
224 send_prune(struct gtable *gt)
239 if (gt->gt_route == NULL)
243 if (!pruning_neighbor(gt->gt_route->rt_parent, gt->gt_route->rt_gateway))
249 src = uvifs[gt->gt_route->rt_parent].uv_lcl_addr;
250 dst = gt->gt_route->rt_gateway;
258 gt->gt_prsent_timer = gt->gt_timer;
259 for (pt = gt->gt_pruntbl; pt; pt = pt->pt_next)
260 if (pt->pt_timer < gt->gt_prsent_timer)
261 gt->gt_prsent_timer = pt->pt_timer;
266 gt->gt_grftsnt = 0;
269 *p++ = ((char *)&(gt->gt_route->rt_origin))[i];
271 *p++ = ((char *)&(gt->gt_mcastgrp))[i];
272 tmp = htonl(gt->gt_prsent_timer);
281 inet_fmts(gt->gt_route->rt_origin, gt->gt_route->rt_originmask),
282 inet_fmt(gt->gt_mcastgrp),
283 gt->gt_prsent_timer, gt->gt_route->rt_parent,
284 inet_fmt(gt->gt_route->rt_gateway));
295 send_graft(struct gtable *gt)
304 if (gt->gt_route == NULL)
307 src = uvifs[gt->gt_route->rt_parent].uv_lcl_addr;
308 dst = gt->gt_route->rt_gateway;
314 *p++ = ((char *)&(gt->gt_route->rt_origin))[i];
316 *p++ = ((char *)&(gt->gt_mcastgrp))[i];
324 inet_fmts(gt->gt_route->rt_origin, gt->gt_route->rt_originmask),
325 inet_fmt(gt->gt_mcastgrp),
326 inet_fmt(gt->gt_route->rt_gateway),
327 gt->gt_route->rt_parent);
383 struct gtable *gt;
385 for (gt = kernel_table; gt; gt = gt->gt_gnext) {
386 if (ntohl(grp) < ntohl(gt->gt_mcastgrp))
388 if (gt->gt_mcastgrp == grp)
389 return gt;
399 find_grp_src(struct gtable *gt, u_long src)
402 u_long grp = gt->gt_mcastgrp;
405 for (gtcurr = gt; gtcurr->gt_mcastgrp == grp; gtcurr = gtcurr->gt_gnext) {
423 struct gtable *gt, *gbest = NULL;
433 for (gt = kernel_table; gt; gt=gt->gt_gnext) {
435 if (gbest && gbest->gt_mcastgrp != gt->gt_mcastgrp)
437 for (st = gt->gt_srctbl; st; st=st->st_next) {
440 if (((ntohl(gt->gt_mcastgrp)> ntohl(grp))
441 || (ntohl(gt->gt_mcastgrp)==ntohl(grp)
443 || (ntohl(gt->gt_mcastgrp)==ntohl(grp)
446 || (ntohl(gt->gt_mcastgrp)< ntohl(gbest->gt_mcastgrp))
447 || (ntohl(gt->gt_mcastgrp)==ntohl(gbest->gt_mcastgrp)
449 gbest = gt;
466 refresh_sg(struct sioc_sg_req *sg, struct gtable *gt, struct stable *st)
471 || sg->grp.s_addr!=gt->gt_mcastgrp) {
474 sg->grp.s_addr = gt->gt_mcastgrp;
593 struct gtable *gt,**gtnp,*prev_gt;
608 for (gt = kernel_no_route; gt; gt = gt->gt_next)
609 if (mcastgrp == gt->gt_mcastgrp &&
610 gt->gt_srctbl && gt->gt_srctbl->st_origin == origin)
615 while ((gt = *gtnp) != NULL) {
616 if (gt->gt_mcastgrp >= mcastgrp)
618 gtnp = >->gt_next;
619 prev_gt = gt;
623 if (gt == NULL || gt->gt_mcastgrp != mcastgrp) {
624 gt = (struct gtable *)malloc(sizeof(struct gtable));
625 if (gt == NULL) {
630 gt->gt_mcastgrp = mcastgrp;
631 gt->gt_timer = CACHE_LIFETIME(cache_lifetime);
632 time(>->gt_ctime);
633 gt->gt_grpmems = 0;
634 gt->gt_scope = 0;
635 gt->gt_prsent_timer = 0;
636 gt->gt_grftsnt = 0;
637 gt->gt_srctbl = NULL;
638 gt->gt_pruntbl = NULL;
639 gt->gt_route = r;
641 gt->gt_rsrr_cache = NULL;
649 VIFM_SET(i, gt->gt_grpmems);
652 VIFM_SET(i, gt->gt_grpmems);
654 GET_SCOPE(gt);
655 if (VIFM_ISSET(r->rt_parent, gt->gt_scope))
656 gt->gt_scope = -1;
657 gt->gt_grpmems &= ~gt->gt_scope;
659 gt->gt_scope = -1;
660 gt->gt_grpmems = 0;
664 prun_add_ttls(gt);
666 gt->gt_next = *gtnp;
667 *gtnp = gt;
668 if (gt->gt_next)
669 gt->gt_next->gt_prev = gt;
670 gt->gt_prev = prev_gt;
673 if (find_src_grp(r->rt_origin, r->rt_originmask, gt->gt_mcastgrp)) {
683 gt->gt_gnext = gtp->gt_gnext;
684 gt->gt_gprev = gtp;
685 gtp->gt_gnext = gt;
687 gt->gt_gnext = kernel_table;
688 gt->gt_gprev = NULL;
689 kernel_table = gt;
691 if (gt->gt_gnext)
692 gt->gt_gnext->gt_gprev = gt;
695 gt->gt_gnext = gt->gt_gprev = NULL;
699 stnp = >->gt_srctbl;
724 k_add_rg(origin, gt);
729 k_add_rg(origin, gt);
734 gt->gt_grpmems, r ? r->rt_parent : -1);
740 if (!gt->gt_prsent_timer && !gt->gt_grpmems && r && r->rt_gateway)
741 send_prune(gt);
1549 struct gtable *gt, **gtnp;
1557 for (gt = rp->rt_groups; gt; gt = gt->gt_next) {
1558 stnp = >->gt_srctbl;
1564 inet_fmt(gt->gt_mcastgrp),
1566 if (k_del_rg(st->st_origin, gt) < 0) {
1570 inet_fmt(gt->gt_mcastgrp));
1584 while ((gt = *gtnp) != NULL) {
1585 if (gt->gt_srctbl && ((gt->gt_srctbl->st_origin & rt->rt_originmask)
1589 inet_fmt(gt->gt_srctbl->st_origin),
1590 inet_fmt(gt->gt_mcastgrp),
1592 if (k_del_rg(gt->gt_srctbl->st_origin, gt) < 0) {
1595 inet_fmt(gt->gt_srctbl->st_origin),
1596 inet_fmt(gt->gt_mcastgrp));
1599 free(gt->gt_srctbl);
1600 *gtnp = gt->gt_next;
1601 if (gt->gt_next)
1602 gt->gt_next->gt_prev = gt->gt_prev;
1603 free(gt);
1605 gtnp = >->gt_next;
1619 struct gtable *gt, **gtnptr;
1627 while ((gt = *gtnptr) != NULL) {
1628 r = gt->gt_route;
1631 gt->gt_timer -= ROUTE_MAX_REPORT_DELAY;
1634 if (gt->gt_prsent_timer > 0) {
1635 gt->gt_prsent_timer -= ROUTE_MAX_REPORT_DELAY;
1636 if (gt->gt_prsent_timer <= 0) {
1639 inet_fmt(gt->gt_mcastgrp));
1640 gt->gt_prsent_timer = -1;
1645 if (gt->gt_grftsnt) {
1647 CHK_GS(gt->gt_grftsnt++, y);
1649 send_graft(gt);
1657 ptnp = >->gt_pruntbl;
1662 inet_fmt(gt->gt_mcastgrp),
1666 expire_prune(pt->pt_vifi, gt);
1682 if (gt->gt_timer <= 0) {
1684 sg_req.grp.s_addr = gt->gt_mcastgrp;
1685 stnp = >->gt_srctbl;
1692 inet_fmt(gt->gt_mcastgrp));
1700 inet_fmt(gt->gt_mcastgrp));
1701 if (k_del_rg(st->st_origin, gt) < 0) {
1705 inet_fmt(gt->gt_mcastgrp));
1720 if (gt->gt_pruntbl != NULL || gt->gt_srctbl != NULL ||
1721 gt->gt_prsent_timer > 0) {
1722 gt->gt_timer = CACHE_LIFETIME(cache_lifetime);
1723 if (gt->gt_prsent_timer == -1) {
1724 if (gt->gt_grpmems == 0)
1725 send_prune(gt);
1727 gt->gt_prsent_timer = 0;
1729 gtnptr = >->gt_gnext;
1735 inet_fmt(gt->gt_mcastgrp));
1737 if (gt->gt_prev)
1738 gt->gt_prev->gt_next = gt->gt_next;
1740 gt->gt_route->rt_groups = gt->gt_next;
1741 if (gt->gt_next)
1742 gt->gt_next->gt_prev = gt->gt_prev;
1744 if (gt->gt_gprev) {
1745 gt->gt_gprev->gt_gnext = gt->gt_gnext;
1746 gtnptr = >->gt_gprev->gt_gnext;
1748 kernel_table = gt->gt_gnext;
1751 if (gt->gt_gnext)
1752 gt->gt_gnext->gt_gprev = gt->gt_gprev;
1756 rsrr_cache_send(gt,0);
1757 rsrr_cache_clean(gt);
1759 free((char *)gt);
1761 if (gt->gt_prsent_timer == -1) {
1762 if (gt->gt_grpmems == 0)
1763 send_prune(gt);
1765 gt->gt_prsent_timer = 0;
1767 gtnptr = >->gt_gnext;
1776 while ((gt = *gtnptr) != NULL) {
1778 gt->gt_timer -= ROUTE_MAX_REPORT_DELAY;
1780 if (gt->gt_timer < 0) {
1781 if (gt->gt_srctbl) {
1782 if (k_del_rg(gt->gt_srctbl->st_origin, gt) < 0) {
1785 inet_fmt(gt->gt_srctbl->st_origin),
1786 inet_fmt(gt->gt_mcastgrp));
1788 free(gt->gt_srctbl);
1790 *gtnptr = gt->gt_next;
1791 if (gt->gt_next)
1792 gt->gt_next->gt_prev = gt->gt_prev;
1794 free((char *)gt);
1796 gtnptr = >->gt_next;
1803 * were received on the vif given by vifi, for the group given by gt,
1807 expire_prune(vifi_t vifi, struct gtable *gt)
1813 if (gt->gt_prsent_timer > 0) {
1815 gt->gt_prsent_timer, "prsent_timer");
1816 gt->gt_prsent_timer = 0;
1820 if (!VIFM_ISSET(vifi, gt->gt_grpmems)) {
1821 struct rtentry *rt = gt->gt_route;
1822 VIFM_SET(vifi, gt->gt_grpmems);
1825 inet_fmt(gt->gt_mcastgrp), gt->gt_grpmems, vifi);
1827 prun_add_ttls(gt);
1828 update_kernel(gt);
1831 rsrr_cache_send(gt,1);
1882 struct gtable *gt;
1891 for (gt = kernel_no_route; gt; gt = gt->gt_next) {
1892 if (gt->gt_srctbl) {
1894 inet_fmts(gt->gt_srctbl->st_origin, 0xffffffff),
1895 inet_fmt(gt->gt_mcastgrp), scaletime(gt->gt_timer),
1896 scaletime(thyme - gt->gt_ctime));
1897 fprintf(fp2, ">%s\n", inet_fmt(gt->gt_srctbl->st_origin));
1901 for (gt = kernel_table; gt; gt = gt->gt_gnext) {
1902 r = gt->gt_route;
1905 inet_fmt(gt->gt_mcastgrp));
1907 fprintf(fp2, " %-4s", scaletime(gt->gt_timer));
1909 fprintf(fp2, " %-4s %-4s ", scaletime(thyme - gt->gt_ctime),
1910 gt->gt_prsent_timer ? scaletime(gt->gt_prsent_timer) :
1914 gt->gt_prsent_timer ? 'P' : ' ',
1915 VIFM_ISSET(r->rt_parent, gt->gt_scope) ? 'B' : ' ');
1918 if (VIFM_ISSET(i, gt->gt_grpmems))
1923 VIFM_ISSET(i, gt->gt_scope) ? 'b' : 'p');
1926 for (st = gt->gt_srctbl; st; st = st->st_next) {
1930 for (pt = gt->gt_pruntbl; pt; pt = pt->pt_next) {
1950 struct gtable *gt;
2133 for (gt = rt->rt_groups; gt; gt = gt->gt_next) {
2134 if (gt->gt_mcastgrp >= group)
2138 gt = NULL;
2140 if (gt && gt->gt_mcastgrp == group) {
2146 if (VIFM_ISSET(vifi, gt->gt_scope))
2148 else if (gt->gt_prsent_timer)
2150 else if (!VIFM_ISSET(vifi, gt->gt_grpmems)) {