Lines Matching refs:rt

324 	struct rt6_info *rt;
326 rt = pol_lookup_func(lookup,
328 if (rt->dst.error == -EAGAIN) {
329 ip6_rt_put_flags(rt, flags);
330 rt = net->ipv6.ip6_null_entry;
332 dst_hold(&rt->dst);
335 return &rt->dst;
372 struct fib6_info *rt,
377 .rt = rt,
385 struct fib6_info *rt,
391 .rt = rt,
400 struct fib6_info *rt,
405 .rt = rt,
408 WRITE_ONCE(rt->fib6_table->fib_seq, rt->fib6_table->fib_seq + 1);
414 struct fib6_info *rt,
420 .rt = rt,
424 WRITE_ONCE(rt->fib6_table->fib_seq, rt->fib6_table->fib_seq + 1);
428 int call_fib6_entry_notifiers_replace(struct net *net, struct fib6_info *rt)
431 .rt = rt,
432 .nsiblings = rt->fib6_nsiblings,
435 WRITE_ONCE(rt->fib6_table->fib_seq, rt->fib6_table->fib_seq + 1);
445 static int fib6_rt_dump(struct fib6_info *rt, struct fib6_dump_arg *arg)
451 if (!rt || rt == arg->net->ipv6.fib6_null_entry)
454 nsiblings = READ_ONCE(rt->fib6_nsiblings);
457 rt,
461 err = call_fib6_entry_notifier(arg->nb, fib_event, rt,
528 struct fib6_info *rt;
531 res = rt6_dump_route(rt, w->args, w->skip_in_node);
534 w->leaf = rt;
546 * RTA_MULTIPATH attribute. Jump 'rt' to point to the
550 if (rt->fib6_nsiblings)
551 rt = list_last_entry(&rt->fib6_siblings,
1031 static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
1034 struct fib6_table *table = rt->fib6_table;
1037 rt6_flush_exceptions(rt);
1038 fib6_drop_pcpu_from(rt);
1040 if (rt->nh) {
1041 spin_lock(&rt->nh->lock);
1043 if (!list_empty(&rt->nh_list))
1044 list_del_init(&rt->nh_list);
1046 spin_unlock(&rt->nh->lock);
1049 if (refcount_read(&rt->fib6_ref) != 1) {
1060 if (!(fn->fn_flags & RTN_RTINFO) && leaf == rt) {
1065 fib6_info_release(rt);
1072 fib6_clean_expires(rt);
1073 fib6_remove_gc_list(rt);
1080 static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
1085 lockdep_is_held(&rt->fib6_table->tb6_lock));
1094 bool rt_can_ecmp = rt6_qualify_for_ecmp(rt);
1106 lockdep_is_held(&rt->fib6_table->tb6_lock))) {
1111 if (iter->fib6_metric == rt->fib6_metric) {
1129 if (rt6_duplicate_nexthop(iter, rt)) {
1130 if (rt->fib6_nsiblings)
1131 WRITE_ONCE(rt->fib6_nsiblings, 0);
1134 if (!(rt->fib6_flags & RTF_EXPIRES)) {
1138 fib6_set_expires(iter, rt->expires);
1141 if (!(rt->fib6_flags & (RTF_ADDRCONF | RTF_PREFIX_RT))) {
1146 if (rt->fib6_pmtu)
1148 rt->fib6_pmtu);
1164 WRITE_ONCE(rt->fib6_nsiblings,
1165 rt->fib6_nsiblings + 1);
1168 if (iter->fib6_metric > rt->fib6_metric)
1181 lockdep_is_held(&rt->fib6_table->tb6_lock));
1190 if (rt->fib6_nsiblings) {
1198 if (sibling->fib6_metric == rt->fib6_metric &&
1200 list_add_tail_rcu(&rt->fib6_siblings,
1205 lockdep_is_held(&rt->fib6_table->tb6_lock));
1214 &rt->fib6_siblings, fib6_siblings) {
1217 BUG_ON(sibling->fib6_nsiblings != rt->fib6_nsiblings);
1220 BUG_ON(fib6_nsiblings != rt->fib6_nsiblings);
1249 fib_event, rt,
1257 if (!rt->fib6_nsiblings)
1261 &rt->fib6_siblings,
1265 WRITE_ONCE(rt->fib6_nsiblings, 0);
1266 list_del_rcu(&rt->fib6_siblings);
1274 rcu_assign_pointer(rt->fib6_next, iter);
1275 fib6_info_hold(rt);
1276 rcu_assign_pointer(rt->fib6_node, fn);
1277 rcu_assign_pointer(*ins, rt);
1279 inet6_rt_notify(RTM_NEWROUTE, rt, info, nlflags);
1300 rt, extack);
1305 fib6_info_hold(rt);
1306 rcu_assign_pointer(rt->fib6_node, fn);
1307 rt->fib6_next = iter->fib6_next;
1308 rcu_assign_pointer(*ins, rt);
1310 inet6_rt_notify(RTM_NEWROUTE, rt, info, NLM_F_REPLACE);
1323 ins = &rt->fib6_next;
1325 lockdep_is_held(&rt->fib6_table->tb6_lock));
1327 if (iter->fib6_metric > rt->fib6_metric)
1341 lockdep_is_held(&rt->fib6_table->tb6_lock));
1350 static int fib6_add_rt2node_nh(struct fib6_node *fn, struct fib6_info *rt,
1356 spin_lock(&rt->nh->lock);
1358 if (rt->nh->dead) {
1362 err = fib6_add_rt2node(fn, rt, info, extack, purge_list);
1364 list_add(&rt->nh_list, &rt->nh->f6i_list);
1367 spin_unlock(&rt->nh->lock);
1372 static void fib6_start_gc(struct net *net, struct fib6_info *rt)
1375 (rt->fib6_flags & RTF_EXPIRES))
1387 static void __fib6_update_sernum_upto_root(struct fib6_info *rt,
1390 struct fib6_node *fn = rcu_dereference_protected(rt->fib6_node,
1391 lockdep_is_held(&rt->fib6_table->tb6_lock));
1398 lockdep_is_held(&rt->fib6_table->tb6_lock));
1402 void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt)
1404 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(net));
1422 int fib6_add(struct fib6_node *root, struct fib6_info *rt,
1425 struct fib6_table *table = rt->fib6_table;
1445 &rt->fib6_dst.addr, rt->fib6_dst.plen,
1457 if (rt->fib6_src.plen) {
1486 &rt->fib6_src.addr, rt->fib6_src.plen,
1505 &rt->fib6_src.addr, rt->fib6_src.plen,
1521 fib6_info_hold(rt);
1522 rcu_assign_pointer(fn->leaf, rt);
1529 if (rt->nh)
1530 err = fib6_add_rt2node_nh(fn, rt, info, extack, &purge_list);
1532 err = fib6_add_rt2node(fn, rt, info, extack, &purge_list);
1542 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net));
1544 if (rt->fib6_flags & RTF_EXPIRES)
1545 fib6_add_gc_list(rt);
1547 fib6_start_gc(info->nl_net, rt);
1561 if (pn_leaf == rt) {
1564 fib6_info_release(rt);
1578 } else if (fib6_requires_src(rt)) {
1971 struct fib6_info *rt = rcu_dereference_protected(*rtp,
1982 if (leaf == rt && !rt->fib6_nsiblings) {
1983 if (rcu_access_pointer(rt->fib6_next))
1984 replace_rt = rcu_dereference_protected(rt->fib6_next,
1991 *rtp = rt->fib6_next;
1992 rt->fib6_node = NULL;
1997 if (rcu_access_pointer(fn->rr_ptr) == rt)
2001 if (rt->fib6_nsiblings) {
2009 if (rt->fib6_metric == leaf->fib6_metric &&
2013 &rt->fib6_siblings, fib6_siblings)
2016 WRITE_ONCE(rt->fib6_nsiblings, 0);
2017 list_del_rcu(&rt->fib6_siblings);
2024 if (w->state == FWS_C && w->leaf == rt) {
2026 w->leaf = rcu_dereference_protected(rt->fib6_next,
2046 fib6_purge_rt(rt, fn, net);
2051 rt, NULL);
2056 inet6_rt_notify(RTM_DELROUTE, rt, info, 0);
2058 fib6_info_release(rt);
2062 int fib6_del(struct fib6_info *rt, struct nl_info *info)
2070 if (rt == net->ipv6.fib6_null_entry)
2073 table = rt->fib6_table;
2074 fn = rcu_dereference_protected(rt->fib6_node,
2088 if (rt == cur) {
2232 struct fib6_info *rt;
2250 res = c->func(rt, c->arg);
2252 w->leaf = rt;
2253 res = fib6_del(rt, &info);
2256 pr_debug("%s: del failed: rt=%p@%p err=%d\n",
2257 __func__, rt,
2258 rcu_access_pointer(rt->fib6_node),
2265 if (WARN_ON(!rt->fib6_nsiblings))
2267 rt = list_last_entry(&rt->fib6_siblings,
2273 w->leaf = rt;
2351 static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args)
2360 if (rt->fib6_flags & RTF_EXPIRES && rt->expires) {
2361 if (time_after(now, rt->expires)) {
2362 pr_debug("expiring %p\n", rt);
2372 rt6_age_exceptions(rt, gc_args, now);
2381 struct fib6_info *rt;
2388 hlist_for_each_entry_safe(rt, n, &tb6->tb6_gc_hlist, gc_link)
2389 if (fib6_age(rt, gc_args) == -1)
2390 fib6_del(rt, &info);
2592 struct fib6_info *rt = v;
2594 struct fib6_nh *fib6_nh = rt->fib6_nh;
2595 unsigned int flags = rt->fib6_flags;
2598 if (rt->nh)
2599 fib6_nh = nexthop_fib6_nh(rt->nh);
2601 seq_printf(seq, "%pi6 %02x ", &rt->fib6_dst.addr, rt->fib6_dst.plen);
2604 seq_printf(seq, "%pi6 %02x ", &rt->fib6_src.addr, rt->fib6_src.plen);
2617 rt->fib6_metric, refcount_read(&rt->fib6_ref), 0,
2772 ctx.rt = v;