Lines Matching refs:mrt
73 struct mr_table *mrt; member
103 static void ipmr_free_table(struct mr_table *mrt);
105 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
108 static int ipmr_cache_report(const struct mr_table *mrt,
110 static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
112 static void igmpmsg_netlink_event(const struct mr_table *mrt, struct sk_buff *pkt);
113 static void mroute_clean_tables(struct mr_table *mrt, int flags);
117 #define ipmr_for_each_table(mrt, net) \ argument
118 list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \
123 struct mr_table *mrt) in ipmr_mr_table_iter() argument
127 if (!mrt) in ipmr_mr_table_iter()
131 ret = list_entry_rcu(mrt->list.next, in ipmr_mr_table_iter()
141 struct mr_table *mrt; in ipmr_get_table() local
143 ipmr_for_each_table(mrt, net) { in ipmr_get_table()
144 if (mrt->id == id) in ipmr_get_table()
145 return mrt; in ipmr_get_table()
151 struct mr_table **mrt) in ipmr_fib_lookup() argument
167 *mrt = res.mrt; in ipmr_fib_lookup()
175 struct mr_table *mrt; in ipmr_rule_action() local
191 mrt = ipmr_get_table(rule->fr_net, arg->table); in ipmr_rule_action()
192 if (!mrt) in ipmr_rule_action()
194 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()
265 ipmr_free_table(mrt); in ipmr_rules_init()
274 struct mr_table *mrt, *next; in ipmr_rules_exit() local
277 list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { in ipmr_rules_exit()
278 list_del(&mrt->list); in ipmr_rules_exit()
279 ipmr_free_table(mrt); in ipmr_rules_exit()
301 #define ipmr_for_each_table(mrt, net) \ argument
302 for (mrt = net->ipv4.mrt; mrt; mrt = NULL)
305 struct mr_table *mrt) in ipmr_mr_table_iter() argument
307 if (!mrt) in ipmr_mr_table_iter()
308 return net->ipv4.mrt; in ipmr_mr_table_iter()
314 return net->ipv4.mrt; in ipmr_get_table()
318 struct mr_table **mrt) in ipmr_fib_lookup() argument
320 *mrt = net->ipv4.mrt; in ipmr_fib_lookup()
326 struct mr_table *mrt; in ipmr_rules_init() local
328 mrt = ipmr_new_table(net, RT_TABLE_DEFAULT); in ipmr_rules_init()
329 if (IS_ERR(mrt)) in ipmr_rules_init()
330 return PTR_ERR(mrt); in ipmr_rules_init()
331 net->ipv4.mrt = mrt; in ipmr_rules_init()
338 ipmr_free_table(net->ipv4.mrt); in ipmr_rules_exit()
339 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 timer_shutdown_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()
514 ipmr_cache_report(mrt, skb, READ_ONCE(mrt->mroute_reg_vif_num), in reg_vif_xmit()
542 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) in ipmr_reg_vif() argument
547 if (mrt->id == RT_TABLE_DEFAULT) in ipmr_reg_vif()
550 sprintf(name, "pimreg%u", mrt->id); in ipmr_reg_vif()
579 static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb, in __pim_rcv() argument
598 vif_num = READ_ONCE(mrt->mroute_reg_vif_num); in __pim_rcv()
600 reg_dev = vif_dev_read(&mrt->vif_table[vif_num]); in __pim_rcv()
617 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) in ipmr_reg_vif() argument
649 static int vif_delete(struct mr_table *mrt, int vifi, int notify, in vif_delete() argument
652 struct net *net = read_pnet(&mrt->net); in vif_delete()
657 if (vifi < 0 || vifi >= mrt->maxvif) in vif_delete()
660 v = &mrt->vif_table[vifi]; in vif_delete()
668 vifi, mrt->id); in vif_delete()
671 if (vifi == mrt->mroute_reg_vif_num) { in vif_delete()
673 WRITE_ONCE(mrt->mroute_reg_vif_num, -1); in vif_delete()
675 if (vifi + 1 == mrt->maxvif) { in vif_delete()
679 if (VIF_EXISTS(mrt, tmp)) in vif_delete()
682 WRITE_ONCE(mrt->maxvif, tmp + 1); in vif_delete()
720 static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) in ipmr_destroy_unres() argument
722 struct net *net = read_pnet(&mrt->net); in ipmr_destroy_unres()
726 atomic_dec(&mrt->cache_resolve_queue_len); in ipmr_destroy_unres()
751 struct mr_table *mrt = from_timer(mrt, t, ipmr_expire_timer); in ipmr_expire_process() local
757 mod_timer(&mrt->ipmr_expire_timer, jiffies+HZ/10); in ipmr_expire_process()
761 if (list_empty(&mrt->mfc_unres_queue)) in ipmr_expire_process()
767 list_for_each_entry_safe(c, next, &mrt->mfc_unres_queue, list) { in ipmr_expire_process()
776 mroute_netlink_event(mrt, (struct mfc_cache *)c, RTM_DELROUTE); in ipmr_expire_process()
777 ipmr_destroy_unres(mrt, (struct mfc_cache *)c); in ipmr_expire_process()
780 if (!list_empty(&mrt->mfc_unres_queue)) in ipmr_expire_process()
781 mod_timer(&mrt->ipmr_expire_timer, jiffies + expires); in ipmr_expire_process()
788 static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache, in ipmr_update_thresholds() argument
797 for (vifi = 0; vifi < mrt->maxvif; vifi++) { in ipmr_update_thresholds()
798 if (VIF_EXISTS(mrt, vifi) && in ipmr_update_thresholds()
810 static int vif_add(struct net *net, struct mr_table *mrt, in vif_add() argument
815 struct vif_device *v = &mrt->vif_table[vifi]; in vif_add()
821 if (VIF_EXISTS(mrt, vifi)) in vif_add()
831 if (mrt->mroute_reg_vif_num >= 0) in vif_add()
833 dev = ipmr_reg_vif(net, mrt); in vif_add()
904 WRITE_ONCE(mrt->mroute_reg_vif_num, vifi); in vif_add()
906 if (vifi+1 > mrt->maxvif) in vif_add()
907 WRITE_ONCE(mrt->maxvif, vifi + 1); in vif_add()
910 vifi, mrt->id); in vif_add()
915 static struct mfc_cache *ipmr_cache_find(struct mr_table *mrt, in ipmr_cache_find() argument
924 return mr_mfc_find(mrt, &arg); in ipmr_cache_find()
928 static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt, in ipmr_cache_find_any() argument
937 return mr_mfc_find_any_parent(mrt, vifi); in ipmr_cache_find_any()
938 return mr_mfc_find_any(mrt, vifi, &arg); in ipmr_cache_find_any()
942 static struct mfc_cache *ipmr_cache_find_parent(struct mr_table *mrt, in ipmr_cache_find_parent() argument
951 return mr_mfc_find_parent(mrt, &arg, parent); in ipmr_cache_find_parent()
980 static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, in ipmr_cache_resolve() argument
992 if (mr_fill_mroute(mrt, skb, &c->_c, in ipmr_cache_resolve()
1008 ip_mr_forward(net, mrt, skb->dev, skb, c, 0); in ipmr_cache_resolve()
1018 static int ipmr_cache_report(const struct mr_table *mrt, in ipmr_cache_report() argument
1028 mroute_sk = rcu_dereference(mrt->mroute_sk); in ipmr_cache_report()
1058 int vif_num = READ_ONCE(mrt->mroute_reg_vif_num); in ipmr_cache_report()
1087 igmpmsg_netlink_event(mrt, skb); in ipmr_cache_report()
1102 static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, in ipmr_cache_unresolved() argument
1111 list_for_each_entry(c, &mrt->mfc_unres_queue, _c.list) { in ipmr_cache_unresolved()
1135 err = ipmr_cache_report(mrt, skb, vifi, IGMPMSG_NOCACHE); in ipmr_cache_unresolved()
1148 atomic_inc(&mrt->cache_resolve_queue_len); in ipmr_cache_unresolved()
1149 list_add(&c->_c.list, &mrt->mfc_unres_queue); in ipmr_cache_unresolved()
1150 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_cache_unresolved()
1152 if (atomic_read(&mrt->cache_resolve_queue_len) == 1) in ipmr_cache_unresolved()
1153 mod_timer(&mrt->ipmr_expire_timer, in ipmr_cache_unresolved()
1176 static int ipmr_mfc_delete(struct mr_table *mrt, struct mfcctl *mfc, int parent) in ipmr_mfc_delete() argument
1178 struct net *net = read_pnet(&mrt->net); in ipmr_mfc_delete()
1183 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_delete()
1188 rhltable_remove(&mrt->mfc_hash, &c->_c.mnode, ipmr_rht_params); in ipmr_mfc_delete()
1190 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, c, mrt->id); in ipmr_mfc_delete()
1191 mroute_netlink_event(mrt, c, RTM_DELROUTE); in ipmr_mfc_delete()
1197 static int ipmr_mfc_add(struct net *net, struct mr_table *mrt, in ipmr_mfc_add() argument
1210 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_add()
1216 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1221 mrt->id); in ipmr_mfc_add()
1222 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1237 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1241 ret = rhltable_insert_key(&mrt->mfc_hash, &c->cmparg, &c->_c.mnode, in ipmr_mfc_add()
1248 list_add_tail_rcu(&c->_c.list, &mrt->mfc_cache_list); in ipmr_mfc_add()
1254 list_for_each_entry(_uc, &mrt->mfc_unres_queue, list) { in ipmr_mfc_add()
1259 atomic_dec(&mrt->cache_resolve_queue_len); in ipmr_mfc_add()
1264 if (list_empty(&mrt->mfc_unres_queue)) in ipmr_mfc_add()
1265 del_timer(&mrt->ipmr_expire_timer); in ipmr_mfc_add()
1269 ipmr_cache_resolve(net, mrt, uc, c); in ipmr_mfc_add()
1272 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_ADD, c, mrt->id); in ipmr_mfc_add()
1273 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1278 static void mroute_clean_tables(struct mr_table *mrt, int flags) in mroute_clean_tables() argument
1280 struct net *net = read_pnet(&mrt->net); in mroute_clean_tables()
1288 for (i = 0; i < mrt->maxvif; i++) { in mroute_clean_tables()
1289 if (((mrt->vif_table[i].flags & VIFF_STATIC) && in mroute_clean_tables()
1291 (!(mrt->vif_table[i].flags & VIFF_STATIC) && !(flags & MRT_FLUSH_VIFS))) in mroute_clean_tables()
1293 vif_delete(mrt, i, 0, &list); in mroute_clean_tables()
1300 list_for_each_entry_safe(c, tmp, &mrt->mfc_cache_list, list) { in mroute_clean_tables()
1304 rhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params); in mroute_clean_tables()
1308 mrt->id); in mroute_clean_tables()
1309 mroute_netlink_event(mrt, cache, RTM_DELROUTE); in mroute_clean_tables()
1315 if (atomic_read(&mrt->cache_resolve_queue_len) != 0) { in mroute_clean_tables()
1317 list_for_each_entry_safe(c, tmp, &mrt->mfc_unres_queue, list) { in mroute_clean_tables()
1320 mroute_netlink_event(mrt, cache, RTM_DELROUTE); in mroute_clean_tables()
1321 ipmr_destroy_unres(mrt, cache); in mroute_clean_tables()
1334 struct mr_table *mrt; in mrtsock_destruct() local
1337 ipmr_for_each_table(mrt, net) { in mrtsock_destruct()
1338 if (sk == rtnl_dereference(mrt->mroute_sk)) { in mrtsock_destruct()
1344 RCU_INIT_POINTER(mrt->mroute_sk, NULL); in mrtsock_destruct()
1345 mroute_clean_tables(mrt, MRT_FLUSH_VIFS | MRT_FLUSH_MFC); in mrtsock_destruct()
1362 struct mr_table *mrt; in ip_mroute_setsockopt() local
1376 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ip_mroute_setsockopt()
1377 if (!mrt) { in ip_mroute_setsockopt()
1382 if (sk != rcu_access_pointer(mrt->mroute_sk) && in ip_mroute_setsockopt()
1395 if (rtnl_dereference(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1402 rcu_assign_pointer(mrt->mroute_sk, sk); in ip_mroute_setsockopt()
1411 if (sk != rcu_access_pointer(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1438 ret = vif_add(net, mrt, &vif, in ip_mroute_setsockopt()
1439 sk == rtnl_dereference(mrt->mroute_sk)); in ip_mroute_setsockopt()
1441 ret = vif_delete(mrt, vif.vifc_vifi, 0, NULL); in ip_mroute_setsockopt()
1464 ret = ipmr_mfc_delete(mrt, &mfc, parent); in ip_mroute_setsockopt()
1466 ret = ipmr_mfc_add(net, mrt, &mfc, in ip_mroute_setsockopt()
1467 sk == rtnl_dereference(mrt->mroute_sk), in ip_mroute_setsockopt()
1479 mroute_clean_tables(mrt, val); in ip_mroute_setsockopt()
1491 mrt->mroute_do_assert = val; in ip_mroute_setsockopt()
1509 if (val != mrt->mroute_do_pim) { in ip_mroute_setsockopt()
1510 mrt->mroute_do_pim = val; in ip_mroute_setsockopt()
1511 mrt->mroute_do_assert = val; in ip_mroute_setsockopt()
1512 mrt->mroute_do_wrvifwhole = do_wrvifwhole; in ip_mroute_setsockopt()
1529 if (sk == rtnl_dereference(mrt->mroute_sk)) { in ip_mroute_setsockopt()
1532 mrt = ipmr_new_table(net, uval); in ip_mroute_setsockopt()
1533 if (IS_ERR(mrt)) in ip_mroute_setsockopt()
1534 ret = PTR_ERR(mrt); in ip_mroute_setsockopt()
1578 struct mr_table *mrt; in ip_mroute_getsockopt() local
1584 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ip_mroute_getsockopt()
1585 if (!mrt) in ip_mroute_getsockopt()
1595 val = mrt->mroute_do_pim; in ip_mroute_getsockopt()
1598 val = mrt->mroute_do_assert; in ip_mroute_getsockopt()
1626 struct mr_table *mrt; in ipmr_ioctl() local
1628 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ipmr_ioctl()
1629 if (!mrt) in ipmr_ioctl()
1635 if (vr->vifi >= mrt->maxvif) in ipmr_ioctl()
1637 vr->vifi = array_index_nospec(vr->vifi, mrt->maxvif); in ipmr_ioctl()
1639 vif = &mrt->vif_table[vr->vifi]; in ipmr_ioctl()
1640 if (VIF_EXISTS(mrt, vr->vifi)) { in ipmr_ioctl()
1655 c = ipmr_cache_find(mrt, sr->src.s_addr, sr->grp.s_addr); in ipmr_ioctl()
1694 struct mr_table *mrt; in ipmr_compat_ioctl() local
1696 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); in ipmr_compat_ioctl()
1697 if (!mrt) in ipmr_compat_ioctl()
1704 if (vr.vifi >= mrt->maxvif) in ipmr_compat_ioctl()
1706 vr.vifi = array_index_nospec(vr.vifi, mrt->maxvif); in ipmr_compat_ioctl()
1708 vif = &mrt->vif_table[vr.vifi]; in ipmr_compat_ioctl()
1709 if (VIF_EXISTS(mrt, vr.vifi)) { in ipmr_compat_ioctl()
1727 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); in ipmr_compat_ioctl()
1750 struct mr_table *mrt; in ipmr_device_event() local
1757 ipmr_for_each_table(mrt, net) { in ipmr_device_event()
1758 v = &mrt->vif_table[0]; in ipmr_device_event()
1759 for (ct = 0; ct < mrt->maxvif; ct++, v++) { in ipmr_device_event()
1761 vif_delete(mrt, ct, 1, NULL); in ipmr_device_event()
1816 static bool ipmr_forward_offloaded(struct sk_buff *skb, struct mr_table *mrt, in ipmr_forward_offloaded() argument
1819 struct vif_device *out_vif = &mrt->vif_table[out_vifi]; in ipmr_forward_offloaded()
1820 struct vif_device *in_vif = &mrt->vif_table[in_vifi]; in ipmr_forward_offloaded()
1830 static bool ipmr_forward_offloaded(struct sk_buff *skb, struct mr_table *mrt, in ipmr_forward_offloaded() argument
1839 static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, in ipmr_queue_xmit() argument
1843 struct vif_device *vif = &mrt->vif_table[vifi]; in ipmr_queue_xmit()
1859 ipmr_cache_report(mrt, skb, vifi, IGMPMSG_WHOLEPKT); in ipmr_queue_xmit()
1863 if (ipmr_forward_offloaded(skb, mrt, in_vifi, vifi)) in ipmr_queue_xmit()
1942 static int ipmr_find_vif(const struct mr_table *mrt, struct net_device *dev) in ipmr_find_vif() argument
1946 for (ct = READ_ONCE(mrt->maxvif) - 1; ct >= 0; ct--) { in ipmr_find_vif()
1947 if (rcu_access_pointer(mrt->vif_table[ct].dev) == dev) in ipmr_find_vif()
1955 static void ip_mr_forward(struct net *net, struct mr_table *mrt, in ip_mr_forward() argument
1959 int true_vifi = ipmr_find_vif(mrt, dev); in ip_mr_forward()
1974 cache_proxy = mr_mfc_find_any_parent(mrt, vif); in ip_mr_forward()
1981 if (rcu_access_pointer(mrt->vif_table[vif].dev) != dev) { in ip_mr_forward()
1999 if (true_vifi >= 0 && mrt->mroute_do_assert && in ip_mr_forward()
2005 (mrt->mroute_do_pim || in ip_mr_forward()
2011 ipmr_cache_report(mrt, skb, true_vifi, IGMPMSG_WRONGVIF); in ip_mr_forward()
2012 if (mrt->mroute_do_wrvifwhole) in ip_mr_forward()
2013 ipmr_cache_report(mrt, skb, true_vifi, in ip_mr_forward()
2020 WRITE_ONCE(mrt->vif_table[vif].pkt_in, in ip_mr_forward()
2021 mrt->vif_table[vif].pkt_in + 1); in ip_mr_forward()
2022 WRITE_ONCE(mrt->vif_table[vif].bytes_in, in ip_mr_forward()
2023 mrt->vif_table[vif].bytes_in + skb->len); in ip_mr_forward()
2051 ipmr_queue_xmit(net, mrt, true_vifi, in ip_mr_forward()
2063 ipmr_queue_xmit(net, mrt, true_vifi, skb2, in ip_mr_forward()
2066 ipmr_queue_xmit(net, mrt, true_vifi, skb, psend); in ip_mr_forward()
2091 struct mr_table *mrt; in ipmr_rt_fib_lookup() local
2094 err = ipmr_fib_lookup(net, &fl4, &mrt); in ipmr_rt_fib_lookup()
2097 return mrt; in ipmr_rt_fib_lookup()
2108 struct mr_table *mrt; in ip_mr_input() local
2130 mrt = ipmr_rt_fib_lookup(net, skb); in ip_mr_input()
2131 if (IS_ERR(mrt)) { in ip_mr_input()
2133 return PTR_ERR(mrt); in ip_mr_input()
2148 mroute_sk = rcu_dereference(mrt->mroute_sk); in ip_mr_input()
2158 cache = ipmr_cache_find(mrt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr); in ip_mr_input()
2160 int vif = ipmr_find_vif(mrt, dev); in ip_mr_input()
2163 cache = ipmr_cache_find_any(mrt, ip_hdr(skb)->daddr, in ip_mr_input()
2179 vif = ipmr_find_vif(mrt, dev); in ip_mr_input()
2181 return ipmr_cache_unresolved(mrt, vif, skb, dev); in ip_mr_input()
2186 ip_mr_forward(net, mrt, dev, skb, cache, local); in ip_mr_input()
2206 struct mr_table *mrt; in pim_rcv_v1() local
2213 mrt = ipmr_rt_fib_lookup(net, skb); in pim_rcv_v1()
2214 if (IS_ERR(mrt)) in pim_rcv_v1()
2216 if (!mrt->mroute_do_pim || in pim_rcv_v1()
2220 if (__pim_rcv(mrt, skb, sizeof(*pim))) { in pim_rcv_v1()
2233 struct mr_table *mrt; in pim_rcv() local
2245 mrt = ipmr_rt_fib_lookup(net, skb); in pim_rcv()
2246 if (IS_ERR(mrt)) in pim_rcv()
2248 if (__pim_rcv(mrt, skb, sizeof(*pim))) { in pim_rcv()
2261 struct mr_table *mrt; in ipmr_get_route() local
2264 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_get_route()
2265 if (!mrt) in ipmr_get_route()
2269 cache = ipmr_cache_find(mrt, saddr, daddr); in ipmr_get_route()
2271 int vif = ipmr_find_vif(mrt, skb->dev); in ipmr_get_route()
2274 cache = ipmr_cache_find_any(mrt, daddr, vif); in ipmr_get_route()
2284 vif = ipmr_find_vif(mrt, dev); in ipmr_get_route()
2304 err = ipmr_cache_unresolved(mrt, vif, skb2, dev); in ipmr_get_route()
2309 err = mr_fill_mroute(mrt, skb, &cache->_c, rtm); in ipmr_get_route()
2314 static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, in ipmr_fill_mroute() argument
2331 rtm->rtm_table = mrt->id; in ipmr_fill_mroute()
2332 if (nla_put_u32(skb, RTA_TABLE, mrt->id)) in ipmr_fill_mroute()
2345 err = mr_fill_mroute(mrt, skb, &c->_c, rtm); in ipmr_fill_mroute()
2358 static int _ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, in _ipmr_fill_mroute() argument
2362 return ipmr_fill_mroute(mrt, skb, portid, seq, (struct mfc_cache *)c, in _ipmr_fill_mroute()
2387 static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc, in mroute_netlink_event() argument
2390 struct net *net = read_pnet(&mrt->net); in mroute_netlink_event()
2395 mrt->maxvif), in mroute_netlink_event()
2400 err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0); in mroute_netlink_event()
2429 static void igmpmsg_netlink_event(const struct mr_table *mrt, struct sk_buff *pkt) in igmpmsg_netlink_event() argument
2431 struct net *net = read_pnet(&mrt->net); in igmpmsg_netlink_event()
2458 nla_put_u32(skb, IPMRA_CREPORT_TABLE, mrt->id)) in igmpmsg_netlink_event()
2540 struct mr_table *mrt; in ipmr_rtm_getroute() local
2553 mrt = ipmr_get_table(net, tableid ? tableid : RT_TABLE_DEFAULT); in ipmr_rtm_getroute()
2554 if (!mrt) { in ipmr_rtm_getroute()
2561 cache = ipmr_cache_find(mrt, src, grp); in ipmr_rtm_getroute()
2568 skb = nlmsg_new(mroute_msgsize(false, mrt->maxvif), GFP_KERNEL); in ipmr_rtm_getroute()
2574 err = ipmr_fill_mroute(mrt, skb, NETLINK_CB(in_skb).portid, in ipmr_rtm_getroute()
2603 struct mr_table *mrt; in ipmr_rtm_dumproute() local
2605 mrt = ipmr_get_table(sock_net(skb->sk), filter.table_id); in ipmr_rtm_dumproute()
2606 if (!mrt) { in ipmr_rtm_dumproute()
2613 err = mr_table_dump(mrt, skb, cb, _ipmr_fill_mroute, in ipmr_rtm_dumproute()
2663 struct mr_table *mrt; in rtm_to_ipmr_mfcc() local
2713 mrt = ipmr_get_table(net, tblid); in rtm_to_ipmr_mfcc()
2714 if (!mrt) { in rtm_to_ipmr_mfcc()
2718 *mrtret = mrt; in rtm_to_ipmr_mfcc()
2721 mfcc->mfcc_parent = ipmr_find_vif(mrt, dev); in rtm_to_ipmr_mfcc()
2749 static bool ipmr_fill_table(struct mr_table *mrt, struct sk_buff *skb) in ipmr_fill_table() argument
2751 u32 queue_len = atomic_read(&mrt->cache_resolve_queue_len); in ipmr_fill_table()
2753 if (nla_put_u32(skb, IPMRA_TABLE_ID, mrt->id) || in ipmr_fill_table()
2756 mrt->mroute_reg_vif_num) || in ipmr_fill_table()
2758 mrt->mroute_do_assert) || in ipmr_fill_table()
2759 nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_PIM, mrt->mroute_do_pim) || in ipmr_fill_table()
2761 mrt->mroute_do_wrvifwhole)) in ipmr_fill_table()
2767 static bool ipmr_fill_vif(struct mr_table *mrt, u32 vifid, struct sk_buff *skb) in ipmr_fill_vif() argument
2773 vif = &mrt->vif_table[vifid]; in ipmr_fill_vif()
2835 struct mr_table *mrt; in ipmr_rtm_dumplink() local
2847 ipmr_for_each_table(mrt, net) { in ipmr_rtm_dumplink()
2870 if (!ipmr_fill_table(mrt, skb)) { in ipmr_rtm_dumplink()
2881 for (i = 0; i < mrt->maxvif; i++) { in ipmr_rtm_dumplink()
2884 if (!ipmr_fill_vif(mrt, i, skb)) { in ipmr_rtm_dumplink()
2919 struct mr_table *mrt; in ipmr_vif_seq_start() local
2921 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_vif_seq_start()
2922 if (!mrt) in ipmr_vif_seq_start()
2925 iter->mrt = mrt; in ipmr_vif_seq_start()
2940 struct mr_table *mrt = iter->mrt; in ipmr_vif_seq_show() local
2954 vif - mrt->vif_table, in ipmr_vif_seq_show()
2972 struct mr_table *mrt; in ipmr_mfc_seq_start() local
2974 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); in ipmr_mfc_seq_start()
2975 if (!mrt) in ipmr_mfc_seq_start()
2978 return mr_mfc_seq_start(seq, pos, mrt, &mfc_unres_lock); in ipmr_mfc_seq_start()
2991 const struct mr_table *mrt = it->mrt; in ipmr_mfc_seq_show() local
2998 if (it->cache != &mrt->mfc_unres_queue) { in ipmr_mfc_seq_show()
3005 if (VIF_EXISTS(mrt, n) && in ipmr_mfc_seq_show()