Lines Matching refs:mrt
73 struct mr_table *mrt; member
98 static void ipmr_free_table(struct mr_table *mrt);
100 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
103 static int ipmr_cache_report(struct mr_table *mrt,
105 static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
107 static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt);
108 static void mroute_clean_tables(struct mr_table *mrt, int flags);
112 #define ipmr_for_each_table(mrt, net) \ argument
113 list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \
118 struct mr_table *mrt) in ipmr_mr_table_iter() argument
122 if (!mrt) in ipmr_mr_table_iter()
126 ret = list_entry_rcu(mrt->list.next, in ipmr_mr_table_iter()
136 struct mr_table *mrt; in ipmr_get_table() local
138 ipmr_for_each_table(mrt, net) { in ipmr_get_table()
139 if (mrt->id == id) in ipmr_get_table()
140 return mrt; in ipmr_get_table()
146 struct mr_table **mrt) in ipmr_fib_lookup() argument
162 *mrt = res.mrt; in ipmr_fib_lookup()
170 struct mr_table *mrt; in ipmr_rule_action() local
186 mrt = ipmr_get_table(rule->fr_net, arg->table); in ipmr_rule_action()
187 if (!mrt) in ipmr_rule_action()
189 res->mrt = mrt; in ipmr_rule_action()
241 struct mr_table *mrt; in ipmr_rules_init() local
250 mrt = ipmr_new_table(net, RT_TABLE_DEFAULT); in ipmr_rules_init()
251 if (IS_ERR(mrt)) { in ipmr_rules_init()
252 err = PTR_ERR(mrt); in ipmr_rules_init()
264 ipmr_free_table(mrt); in ipmr_rules_init()
272 struct mr_table *mrt, *next; in ipmr_rules_exit() local
275 list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { in ipmr_rules_exit()
276 list_del(&mrt->list); in ipmr_rules_exit()
277 ipmr_free_table(mrt); in ipmr_rules_exit()
300 #define ipmr_for_each_table(mrt, net) \ argument
301 for (mrt = net->ipv4.mrt; mrt; mrt = NULL)
304 struct mr_table *mrt) in ipmr_mr_table_iter() argument
306 if (!mrt) in ipmr_mr_table_iter()
307 return net->ipv4.mrt; in ipmr_mr_table_iter()
313 return net->ipv4.mrt; in ipmr_get_table()
317 struct mr_table **mrt) in ipmr_fib_lookup() argument
319 *mrt = net->ipv4.mrt; in ipmr_fib_lookup()
325 struct mr_table *mrt; in ipmr_rules_init() local
327 mrt = ipmr_new_table(net, RT_TABLE_DEFAULT); in ipmr_rules_init()
328 if (IS_ERR(mrt)) in ipmr_rules_init()
329 return PTR_ERR(mrt); in ipmr_rules_init()
330 net->ipv4.mrt = mrt; in ipmr_rules_init()
337 ipmr_free_table(net->ipv4.mrt); in ipmr_rules_exit()
338 net->ipv4.mrt = NULL; in ipmr_rules_exit()
379 static void ipmr_new_table_set(struct mr_table *mrt, in ipmr_new_table_set() argument
383 list_add_tail_rcu(&mrt->list, &net->ipv4.mr_tables); in ipmr_new_table_set()
399 struct mr_table *mrt; in ipmr_new_table() local
405 mrt = ipmr_get_table(net, id); in ipmr_new_table()
406 if (mrt) in ipmr_new_table()
407 return mrt; in ipmr_new_table()
413 static void ipmr_free_table(struct mr_table *mrt) in ipmr_free_table() argument
415 del_timer_sync(&mrt->ipmr_expire_timer); in ipmr_free_table()
416 mroute_clean_tables(mrt, MRT_FLUSH_VIFS | MRT_FLUSH_VIFS_STATIC | in ipmr_free_table()
418 rhltable_destroy(&mrt->mfc_hash); in ipmr_free_table()
419 kfree(mrt); in ipmr_free_table()
495 struct mr_table *mrt; in reg_vif_xmit() local
503 err = ipmr_fib_lookup(net, &fl4, &mrt); in reg_vif_xmit()
512 ipmr_cache_report(mrt, skb, mrt->mroute_reg_vif_num, IGMPMSG_WHOLEPKT); in reg_vif_xmit()
538 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) in ipmr_reg_vif() argument
543 if (mrt->id == RT_TABLE_DEFAULT) in ipmr_reg_vif()
546 sprintf(name, "pimreg%u", mrt->id); in ipmr_reg_vif()
575 static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb, in __pim_rcv() argument
593 if (mrt->mroute_reg_vif_num >= 0) in __pim_rcv()
594 reg_dev = mrt->vif_table[mrt->mroute_reg_vif_num].dev; in __pim_rcv()
613 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) in ipmr_reg_vif() argument
644 static int vif_delete(struct mr_table *mrt, int vifi, int notify, in vif_delete() argument
647 struct net *net = read_pnet(&mrt->net); in vif_delete()
652 if (vifi < 0 || vifi >= mrt->maxvif) in vif_delete()
655 v = &mrt->vif_table[vifi]; in vif_delete()
657 if (VIF_EXISTS(mrt, vifi)) in vif_delete()
659 mrt->id); in vif_delete()
670 if (vifi == mrt->mroute_reg_vif_num) in vif_delete()
671 mrt->mroute_reg_vif_num = -1; in vif_delete()
673 if (vifi + 1 == mrt->maxvif) { in vif_delete()
677 if (VIF_EXISTS(mrt, tmp)) in vif_delete()
680 mrt->maxvif = tmp+1; in vif_delete()
718 static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) in ipmr_destroy_unres() argument
720 struct net *net = read_pnet(&mrt->net); in ipmr_destroy_unres()
724 atomic_dec(&mrt->cache_resolve_queue_len); in ipmr_destroy_unres()
749 struct mr_table *mrt = from_timer(mrt, t, ipmr_expire_timer); in ipmr_expire_process() local
755 mod_timer(&mrt->ipmr_expire_timer, jiffies+HZ/10); in ipmr_expire_process()
759 if (list_empty(&mrt->mfc_unres_queue)) in ipmr_expire_process()
765 list_for_each_entry_safe(c, next, &mrt->mfc_unres_queue, list) { in ipmr_expire_process()
774 mroute_netlink_event(mrt, (struct mfc_cache *)c, RTM_DELROUTE); in ipmr_expire_process()
775 ipmr_destroy_unres(mrt, (struct mfc_cache *)c); in ipmr_expire_process()
778 if (!list_empty(&mrt->mfc_unres_queue)) in ipmr_expire_process()
779 mod_timer(&mrt->ipmr_expire_timer, jiffies + expires); in ipmr_expire_process()
786 static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache, in ipmr_update_thresholds() argument
795 for (vifi = 0; vifi < mrt->maxvif; vifi++) { in ipmr_update_thresholds()
796 if (VIF_EXISTS(mrt, vifi) && in ipmr_update_thresholds()
808 static int vif_add(struct net *net, struct mr_table *mrt, in vif_add() argument
813 struct vif_device *v = &mrt->vif_table[vifi]; in vif_add()
819 if (VIF_EXISTS(mrt, vifi)) in vif_add()
829 if (mrt->mroute_reg_vif_num >= 0) in vif_add()
831 dev = ipmr_reg_vif(net, mrt); in vif_add()
900 mrt->mroute_reg_vif_num = vifi; in vif_add()
901 if (vifi+1 > mrt->maxvif) in vif_add()
902 mrt->maxvif = vifi+1; in vif_add()
904 call_ipmr_vif_entry_notifiers(net, FIB_EVENT_VIF_ADD, v, vifi, mrt->id); in vif_add()
909 static struct mfc_cache *ipmr_cache_find(struct mr_table *mrt, in ipmr_cache_find() argument
918 return mr_mfc_find(mrt, &arg); in ipmr_cache_find()
922 static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt, in ipmr_cache_find_any() argument
931 return mr_mfc_find_any_parent(mrt, vifi); in ipmr_cache_find_any()
932 return mr_mfc_find_any(mrt, vifi, &arg); in ipmr_cache_find_any()
936 static struct mfc_cache *ipmr_cache_find_parent(struct mr_table *mrt, in ipmr_cache_find_parent() argument
945 return mr_mfc_find_parent(mrt, &arg, parent); in ipmr_cache_find_parent()
974 static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, in ipmr_cache_resolve() argument
986 if (mr_fill_mroute(mrt, skb, &c->_c, in ipmr_cache_resolve()
1001 ip_mr_forward(net, mrt, skb->dev, skb, c, 0); in ipmr_cache_resolve()
1010 static int ipmr_cache_report(struct mr_table *mrt, in ipmr_cache_report() argument
1045 msg->im_vif = mrt->mroute_reg_vif_num; in ipmr_cache_report()
1046 msg->im_vif_hi = mrt->mroute_reg_vif_num >> 8; in ipmr_cache_report()
1072 mroute_sk = rcu_dereference(mrt->mroute_sk); in ipmr_cache_report()
1079 igmpmsg_netlink_event(mrt, skb); in ipmr_cache_report()
1093 static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, in ipmr_cache_unresolved() argument
1102 list_for_each_entry(c, &mrt->mfc_unres_queue, _c.list) { in ipmr_cache_unresolved()
1126 err = ipmr_cache_report(mrt, skb, vifi, IGMPMSG_NOCACHE); in ipmr_cache_unresolved()
1139 atomic_inc(&mrt->cache_resolve_queue_len); in ipmr_cache_unresolved()
1140 list_add(&c->_c.list, &mrt->mfc_unres_queue); in ipmr_cache_unresolved()
1141 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_cache_unresolved()
1143 if (atomic_read(&mrt->cache_resolve_queue_len) == 1) in ipmr_cache_unresolved()
1144 mod_timer(&mrt->ipmr_expire_timer, in ipmr_cache_unresolved()
1167 static int ipmr_mfc_delete(struct mr_table *mrt, struct mfcctl *mfc, int parent) in ipmr_mfc_delete() argument
1169 struct net *net = read_pnet(&mrt->net); in ipmr_mfc_delete()
1174 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_delete()
1179 rhltable_remove(&mrt->mfc_hash, &c->_c.mnode, ipmr_rht_params); in ipmr_mfc_delete()
1181 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, c, mrt->id); in ipmr_mfc_delete()
1182 mroute_netlink_event(mrt, c, RTM_DELROUTE); in ipmr_mfc_delete()
1188 static int ipmr_mfc_add(struct net *net, struct mr_table *mrt, in ipmr_mfc_add() argument
1201 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_add()
1207 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1212 mrt->id); in ipmr_mfc_add()
1213 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1228 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1232 ret = rhltable_insert_key(&mrt->mfc_hash, &c->cmparg, &c->_c.mnode, in ipmr_mfc_add()
1239 list_add_tail_rcu(&c->_c.list, &mrt->mfc_cache_list); in ipmr_mfc_add()
1245 list_for_each_entry(_uc, &mrt->mfc_unres_queue, list) { in ipmr_mfc_add()
1250 atomic_dec(&mrt->cache_resolve_queue_len); in ipmr_mfc_add()
1255 if (list_empty(&mrt->mfc_unres_queue)) in ipmr_mfc_add()
1256 del_timer(&mrt->ipmr_expire_timer); in ipmr_mfc_add()
1260 ipmr_cache_resolve(net, mrt, uc, c); in ipmr_mfc_add()
1263 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_ADD, c, mrt->id); in ipmr_mfc_add()
1264 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1269 static void mroute_clean_tables(struct mr_table *mrt, int flags) in mroute_clean_tables() argument
1271 struct net *net = read_pnet(&mrt->net); in mroute_clean_tables()
1279 for (i = 0; i < mrt->maxvif; i++) { in mroute_clean_tables()
1280 if (((mrt->vif_table[i].flags & VIFF_STATIC) && in mroute_clean_tables()
1282 (!(mrt->vif_table[i].flags & VIFF_STATIC) && !(flags & MRT_FLUSH_VIFS))) in mroute_clean_tables()
1284 vif_delete(mrt, i, 0, &list); in mroute_clean_tables()
1291 list_for_each_entry_safe(c, tmp, &mrt->mfc_cache_list, list) { in mroute_clean_tables()
1295 rhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params); in mroute_clean_tables()
1299 mrt->id); in mroute_clean_tables()
1300 mroute_netlink_event(mrt, cache, RTM_DELROUTE); in mroute_clean_tables()
1306 if (atomic_read(&mrt->cache_resolve_queue_len) != 0) { in mroute_clean_tables()
1308 list_for_each_entry_safe(c, tmp, &mrt->mfc_unres_queue, list) { in mroute_clean_tables()
1311 mroute_netlink_event(mrt, cache, RTM_DELROUTE); in mroute_clean_tables()
1312 ipmr_destroy_unres(mrt, cache); in mroute_clean_tables()
1325 struct mr_table *mrt; in mrtsock_destruct() local
1328 ipmr_for_each_table(mrt, net) { in mrtsock_destruct()
1329 if (sk == rtnl_dereference(mrt->mroute_sk)) { in mrtsock_destruct()
1335 RCU_INIT_POINTER(mrt->mroute_sk, NULL); in mrtsock_destruct()
1336 mroute_clean_tables(mrt, MRT_FLUSH_VIFS | MRT_FLUSH_MFC); in mrtsock_destruct()
1353 struct mr_table *mrt; in ip_mroute_setsockopt() local
1367 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ip_mroute_setsockopt()
1368 if (!mrt) { in ip_mroute_setsockopt()
1373 if (sk != rcu_access_pointer(mrt->mroute_sk) && in ip_mroute_setsockopt()
1386 if (rtnl_dereference(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1393 rcu_assign_pointer(mrt->mroute_sk, sk); in ip_mroute_setsockopt()
1402 if (sk != rcu_access_pointer(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1429 ret = vif_add(net, mrt, &vif, in ip_mroute_setsockopt()
1430 sk == rtnl_dereference(mrt->mroute_sk)); in ip_mroute_setsockopt()
1432 ret = vif_delete(mrt, vif.vifc_vifi, 0, NULL); in ip_mroute_setsockopt()
1455 ret = ipmr_mfc_delete(mrt, &mfc, parent); in ip_mroute_setsockopt()
1457 ret = ipmr_mfc_add(net, mrt, &mfc, in ip_mroute_setsockopt()
1458 sk == rtnl_dereference(mrt->mroute_sk), in ip_mroute_setsockopt()
1470 mroute_clean_tables(mrt, val); in ip_mroute_setsockopt()
1482 mrt->mroute_do_assert = val; in ip_mroute_setsockopt()
1500 if (val != mrt->mroute_do_pim) { in ip_mroute_setsockopt()
1501 mrt->mroute_do_pim = val; in ip_mroute_setsockopt()
1502 mrt->mroute_do_assert = val; in ip_mroute_setsockopt()
1503 mrt->mroute_do_wrvifwhole = do_wrvifwhole; in ip_mroute_setsockopt()
1520 if (sk == rtnl_dereference(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1523 mrt = ipmr_new_table(net, uval); in ip_mroute_setsockopt()
1524 if (IS_ERR(mrt)) in ip_mroute_setsockopt()
1525 ret = PTR_ERR(mrt); in ip_mroute_setsockopt()
1546 struct mr_table *mrt; in ip_mroute_getsockopt() local
1552 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ip_mroute_getsockopt()
1553 if (!mrt) in ip_mroute_getsockopt()
1563 val = mrt->mroute_do_pim; in ip_mroute_getsockopt()
1566 val = mrt->mroute_do_assert; in ip_mroute_getsockopt()
1592 struct mr_table *mrt; in ipmr_ioctl() local
1594 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ipmr_ioctl()
1595 if (!mrt) in ipmr_ioctl()
1602 if (vr.vifi >= mrt->maxvif) in ipmr_ioctl()
1604 vr.vifi = array_index_nospec(vr.vifi, mrt->maxvif); in ipmr_ioctl()
1606 vif = &mrt->vif_table[vr.vifi]; in ipmr_ioctl()
1607 if (VIF_EXISTS(mrt, vr.vifi)) { in ipmr_ioctl()
1625 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); in ipmr_ioctl()
1667 struct mr_table *mrt; in ipmr_compat_ioctl() local
1669 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ipmr_compat_ioctl()
1670 if (!mrt) in ipmr_compat_ioctl()
1677 if (vr.vifi >= mrt->maxvif) in ipmr_compat_ioctl()
1679 vr.vifi = array_index_nospec(vr.vifi, mrt->maxvif); in ipmr_compat_ioctl()
1681 vif = &mrt->vif_table[vr.vifi]; in ipmr_compat_ioctl()
1682 if (VIF_EXISTS(mrt, vr.vifi)) { in ipmr_compat_ioctl()
1700 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); in ipmr_compat_ioctl()
1723 struct mr_table *mrt; in ipmr_device_event() local
1730 ipmr_for_each_table(mrt, net) { in ipmr_device_event()
1731 v = &mrt->vif_table[0]; in ipmr_device_event()
1732 for (ct = 0; ct < mrt->maxvif; ct++, v++) { in ipmr_device_event()
1734 vif_delete(mrt, ct, 1, NULL); in ipmr_device_event()
1790 static bool ipmr_forward_offloaded(struct sk_buff *skb, struct mr_table *mrt, in ipmr_forward_offloaded() argument
1793 struct vif_device *out_vif = &mrt->vif_table[out_vifi]; in ipmr_forward_offloaded()
1794 struct vif_device *in_vif = &mrt->vif_table[in_vifi]; in ipmr_forward_offloaded()
1804 static bool ipmr_forward_offloaded(struct sk_buff *skb, struct mr_table *mrt, in ipmr_forward_offloaded() argument
1813 static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, in ipmr_queue_xmit() argument
1817 struct vif_device *vif = &mrt->vif_table[vifi]; in ipmr_queue_xmit()
1831 ipmr_cache_report(mrt, skb, vifi, IGMPMSG_WHOLEPKT); in ipmr_queue_xmit()
1835 if (ipmr_forward_offloaded(skb, mrt, in_vifi, vifi)) in ipmr_queue_xmit()
1913 static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) in ipmr_find_vif() argument
1917 for (ct = mrt->maxvif-1; ct >= 0; ct--) { in ipmr_find_vif()
1918 if (mrt->vif_table[ct].dev == dev) in ipmr_find_vif()
1925 static void ip_mr_forward(struct net *net, struct mr_table *mrt, in ip_mr_forward() argument
1929 int true_vifi = ipmr_find_vif(mrt, dev); in ip_mr_forward()
1944 cache_proxy = mr_mfc_find_any_parent(mrt, vif); in ip_mr_forward()
1951 if (mrt->vif_table[vif].dev != dev) { in ip_mr_forward()
1969 if (true_vifi >= 0 && mrt->mroute_do_assert && in ip_mr_forward()
1975 (mrt->mroute_do_pim || in ip_mr_forward()
1981 ipmr_cache_report(mrt, skb, true_vifi, IGMPMSG_WRONGVIF); in ip_mr_forward()
1982 if (mrt->mroute_do_wrvifwhole) in ip_mr_forward()
1983 ipmr_cache_report(mrt, skb, true_vifi, in ip_mr_forward()
1990 mrt->vif_table[vif].pkt_in++; in ip_mr_forward()
1991 mrt->vif_table[vif].bytes_in += skb->len; in ip_mr_forward()
2019 ipmr_queue_xmit(net, mrt, true_vifi, in ip_mr_forward()
2031 ipmr_queue_xmit(net, mrt, true_vifi, skb2, in ip_mr_forward()
2034 ipmr_queue_xmit(net, mrt, true_vifi, skb, psend); in ip_mr_forward()
2059 struct mr_table *mrt; in ipmr_rt_fib_lookup() local
2062 err = ipmr_fib_lookup(net, &fl4, &mrt); in ipmr_rt_fib_lookup()
2065 return mrt; in ipmr_rt_fib_lookup()
2076 struct mr_table *mrt; in ip_mr_input() local
2098 mrt = ipmr_rt_fib_lookup(net, skb); in ip_mr_input()
2099 if (IS_ERR(mrt)) { in ip_mr_input()
2101 return PTR_ERR(mrt); in ip_mr_input()
2116 mroute_sk = rcu_dereference(mrt->mroute_sk); in ip_mr_input()
2126 cache = ipmr_cache_find(mrt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr); in ip_mr_input()
2128 int vif = ipmr_find_vif(mrt, dev); in ip_mr_input()
2131 cache = ipmr_cache_find_any(mrt, ip_hdr(skb)->daddr, in ip_mr_input()
2148 vif = ipmr_find_vif(mrt, dev); in ip_mr_input()
2150 int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev); in ip_mr_input()
2161 ip_mr_forward(net, mrt, dev, skb, cache, local); in ip_mr_input()
2182 struct mr_table *mrt; in pim_rcv_v1() local
2189 mrt = ipmr_rt_fib_lookup(net, skb); in pim_rcv_v1()
2190 if (IS_ERR(mrt)) in pim_rcv_v1()
2192 if (!mrt->mroute_do_pim || in pim_rcv_v1()
2196 if (__pim_rcv(mrt, skb, sizeof(*pim))) { in pim_rcv_v1()
2209 struct mr_table *mrt; in pim_rcv() local
2221 mrt = ipmr_rt_fib_lookup(net, skb); in pim_rcv()
2222 if (IS_ERR(mrt)) in pim_rcv()
2224 if (__pim_rcv(mrt, skb, sizeof(*pim))) { in pim_rcv()
2237 struct mr_table *mrt; in ipmr_get_route() local
2240 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_get_route()
2241 if (!mrt) in ipmr_get_route()
2245 cache = ipmr_cache_find(mrt, saddr, daddr); in ipmr_get_route()
2247 int vif = ipmr_find_vif(mrt, skb->dev); in ipmr_get_route()
2250 cache = ipmr_cache_find_any(mrt, daddr, vif); in ipmr_get_route()
2261 vif = ipmr_find_vif(mrt, dev); in ipmr_get_route()
2283 err = ipmr_cache_unresolved(mrt, vif, skb2, dev); in ipmr_get_route()
2290 err = mr_fill_mroute(mrt, skb, &cache->_c, rtm); in ipmr_get_route()
2296 static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, in ipmr_fill_mroute() argument
2313 rtm->rtm_table = mrt->id; in ipmr_fill_mroute()
2314 if (nla_put_u32(skb, RTA_TABLE, mrt->id)) in ipmr_fill_mroute()
2327 err = mr_fill_mroute(mrt, skb, &c->_c, rtm); in ipmr_fill_mroute()
2340 static int _ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, in _ipmr_fill_mroute() argument
2344 return ipmr_fill_mroute(mrt, skb, portid, seq, (struct mfc_cache *)c, in _ipmr_fill_mroute()
2369 static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc, in mroute_netlink_event() argument
2372 struct net *net = read_pnet(&mrt->net); in mroute_netlink_event()
2377 mrt->maxvif), in mroute_netlink_event()
2382 err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0); in mroute_netlink_event()
2411 static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt) in igmpmsg_netlink_event() argument
2413 struct net *net = read_pnet(&mrt->net); in igmpmsg_netlink_event()
2440 nla_put_u32(skb, IPMRA_CREPORT_TABLE, mrt->id)) in igmpmsg_netlink_event()
2522 struct mr_table *mrt; in ipmr_rtm_getroute() local
2535 mrt = ipmr_get_table(net, tableid ? tableid : RT_TABLE_DEFAULT); in ipmr_rtm_getroute()
2536 if (!mrt) { in ipmr_rtm_getroute()
2543 cache = ipmr_cache_find(mrt, src, grp); in ipmr_rtm_getroute()
2550 skb = nlmsg_new(mroute_msgsize(false, mrt->maxvif), GFP_KERNEL); in ipmr_rtm_getroute()
2556 err = ipmr_fill_mroute(mrt, skb, NETLINK_CB(in_skb).portid, in ipmr_rtm_getroute()
2585 struct mr_table *mrt; in ipmr_rtm_dumproute() local
2587 mrt = ipmr_get_table(sock_net(skb->sk), filter.table_id); in ipmr_rtm_dumproute()
2588 if (!mrt) { in ipmr_rtm_dumproute()
2595 err = mr_table_dump(mrt, skb, cb, _ipmr_fill_mroute, in ipmr_rtm_dumproute()
2645 struct mr_table *mrt; in rtm_to_ipmr_mfcc() local
2695 mrt = ipmr_get_table(net, tblid); in rtm_to_ipmr_mfcc()
2696 if (!mrt) { in rtm_to_ipmr_mfcc()
2700 *mrtret = mrt; in rtm_to_ipmr_mfcc()
2703 mfcc->mfcc_parent = ipmr_find_vif(mrt, dev); in rtm_to_ipmr_mfcc()
2731 static bool ipmr_fill_table(struct mr_table *mrt, struct sk_buff *skb) in ipmr_fill_table() argument
2733 u32 queue_len = atomic_read(&mrt->cache_resolve_queue_len); in ipmr_fill_table()
2735 if (nla_put_u32(skb, IPMRA_TABLE_ID, mrt->id) || in ipmr_fill_table()
2738 mrt->mroute_reg_vif_num) || in ipmr_fill_table()
2740 mrt->mroute_do_assert) || in ipmr_fill_table()
2741 nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_PIM, mrt->mroute_do_pim) || in ipmr_fill_table()
2743 mrt->mroute_do_wrvifwhole)) in ipmr_fill_table()
2749 static bool ipmr_fill_vif(struct mr_table *mrt, u32 vifid, struct sk_buff *skb) in ipmr_fill_vif() argument
2755 if (!VIF_EXISTS(mrt, vifid)) in ipmr_fill_vif()
2758 vif = &mrt->vif_table[vifid]; in ipmr_fill_vif()
2814 struct mr_table *mrt; in ipmr_rtm_dumplink() local
2826 ipmr_for_each_table(mrt, net) { in ipmr_rtm_dumplink()
2849 if (!ipmr_fill_table(mrt, skb)) { in ipmr_rtm_dumplink()
2860 for (i = 0; i < mrt->maxvif; i++) { in ipmr_rtm_dumplink()
2863 if (!ipmr_fill_vif(mrt, i, skb)) { in ipmr_rtm_dumplink()
2898 struct mr_table *mrt; in ipmr_vif_seq_start() local
2900 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_vif_seq_start()
2901 if (!mrt) in ipmr_vif_seq_start()
2904 iter->mrt = mrt; in ipmr_vif_seq_start()
2919 struct mr_table *mrt = iter->mrt; in ipmr_vif_seq_show() local
2931 vif - mrt->vif_table, in ipmr_vif_seq_show()
2949 struct mr_table *mrt; in ipmr_mfc_seq_start() local
2951 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_mfc_seq_start()
2952 if (!mrt) in ipmr_mfc_seq_start()
2955 return mr_mfc_seq_start(seq, pos, mrt, &mfc_unres_lock); in ipmr_mfc_seq_start()
2968 const struct mr_table *mrt = it->mrt; in ipmr_mfc_seq_show() local
2975 if (it->cache != &mrt->mfc_unres_queue) { in ipmr_mfc_seq_show()
2982 if (VIF_EXISTS(mrt, n) && in ipmr_mfc_seq_show()