Lines Matching refs:rt
79 static int change_route_byinfo(struct rib_head *rnh, struct rtentry *rt,
83 static int add_route_flags(struct rib_head *rnh, struct rtentry *rt,
86 static int add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt,
91 static int add_route(struct rib_head *rnh, struct rtentry *rt,
93 static int delete_route(struct rib_head *rnh, struct rtentry *rt,
95 static int rt_delete_conditional(struct rib_head *rnh, struct rtentry *rt,
294 rib_match_gw(const struct rtentry *rt, const struct nhop_object *nh, void *gw_sa) in rib_match_gw() argument
310 match_gw_one(const struct rtentry *rt, const struct nhop_object *nh, void *_data) in match_gw_one() argument
328 check_info_match_nhop(const struct rt_addrinfo *info, const struct rtentry *rt, in check_info_match_nhop() argument
334 if (info->rti_filter(rt, nh, info->rti_filterdata) == 0) in check_info_match_nhop()
354 struct rtentry *rt; in lookup_prefix_bysa() local
358 rt = (struct rtentry *)rnh->rnh_lookup(dst, netmask, &rnh->head); in lookup_prefix_bysa()
359 if (rt != NULL) { in lookup_prefix_bysa()
360 rnd->rnd_nhop = rt->rt_nhop; in lookup_prefix_bysa()
361 rnd->rnd_weight = rt->rt_weight; in lookup_prefix_bysa()
367 return (rt); in lookup_prefix_bysa()
371 lookup_prefix_rt(struct rib_head *rnh, const struct rtentry *rt, in lookup_prefix_rt() argument
374 return (lookup_prefix_bysa(rnh, rt_key_const(rt), rt_mask_const(rt), rnd)); in lookup_prefix_rt()
387 struct rtentry *rt; in lookup_prefix() local
389 rt = lookup_prefix_bysa(rnh, info->rti_info[RTAX_DST], in lookup_prefix()
392 return (rt); in lookup_prefix()
485 struct rtentry *rt = NULL; in rib_add_route_px() local
502 if ((rt = rt_alloc(rnh, dst, netmask)) == NULL) { in rib_add_route_px()
511 rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd_tmp); in rib_add_route_px()
514 if (rt == NULL) in rib_add_route_px()
518 return (add_route_flags(rnh, rt, rnd, op_flags, rc)); in rib_add_route_px()
589 struct rtentry *rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd); in rib_del_route_px() local
590 if (rt != NULL) { in rib_del_route_px()
591 error = rt_delete_conditional(rnh, rt, prio, filter_func, in rib_del_route_px()
628 rib_copy_route(struct rtentry *rt, const struct route_nhop_data *rnd_src, in rib_copy_route() argument
639 rt_print_buf(rt, rtbuf, sizeof(rtbuf)); in rib_copy_route()
658 struct rtentry *rt_new = rt_alloc(rh_dst, rt_key(rt), rt_mask(rt)); in rib_copy_route()
731 struct rtentry *rt; in add_route_byinfo() local
762 if ((rt = rt_alloc(rnh, dst, netmask)) == NULL) in add_route_byinfo()
767 rt_free_immediate(rt); in add_route_byinfo()
783 return (add_route_flags(rnh, rt, &rnd_add, op_flags, rc)); in add_route_byinfo()
787 add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data *rnd_add, in add_route_flags() argument
795 MPASS(rt != NULL); in add_route_flags()
801 rt_orig = lookup_prefix_rt(rnh, rt, &rnd_orig); in add_route_flags()
805 error = add_route(rnh, rt, rnd_add, rc); in add_route_flags()
856 rt_free_immediate(rt); in add_route_flags()
865 rt_free_immediate(rt); in add_route_flags()
873 add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt, in add_route_flags_mpath() argument
890 lookup_prefix_rt(rnh, rt, rnd_orig); in add_route_flags_mpath()
899 error = change_route_conditional(rnh, rt, rnd_orig, &rnd_new, rc); in add_route_flags_mpath()
969 struct rtentry *rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd); in rib_del_route() local
970 if (rt != NULL) { in rib_del_route()
971 error = rt_delete_conditional(rnh, rt, prio, filter_func, in rib_del_route()
1006 rt_delete_conditional(struct rib_head *rnh, struct rtentry *rt, in rt_delete_conditional() argument
1009 struct nhop_object *nh = rt->rt_nhop; in rt_delete_conditional()
1019 error = nhgrp_get_filtered_group(rnh, rt, nhg, cb, cbdata, &rnd); in rt_delete_conditional()
1026 error = change_route(rnh, rt, &rnd, rc); in rt_delete_conditional()
1031 if (cb != NULL && !cb(rt, nh, cbdata)) in rt_delete_conditional()
1037 return (delete_route(rnh, rt, rc)); in rt_delete_conditional()
1047 struct rtentry *rt; in rib_change_route() local
1080 rt = (struct rtentry *)rnh->rnh_lookup(info->rti_info[RTAX_DST], in rib_change_route()
1083 if (rt == NULL) { in rib_change_route()
1088 rnd_orig.rnd_nhop = rt->rt_nhop; in rib_change_route()
1089 rnd_orig.rnd_weight = rt->rt_weight; in rib_change_route()
1094 error = change_route_byinfo(rnh, rt, info, &rnd_orig, rc); in rib_change_route()
1134 change_mpath_route(struct rib_head *rnh, struct rtentry *rt, in change_mpath_route() argument
1179 error = change_route_conditional(rnh, rt, rnd_orig, &rnd_new, rc); in change_mpath_route()
1186 change_route_byinfo(struct rib_head *rnh, struct rtentry *rt, in change_route_byinfo() argument
1200 return (change_mpath_route(rnh, rt, info, rnd_orig, rc)); in change_route_byinfo()
1207 error = change_route_conditional(rnh, rt, rnd_orig, &rnd_new, rc); in change_route_byinfo()
1217 add_route(struct rib_head *rnh, struct rtentry *rt, in add_route() argument
1224 rt->rt_nhop = rnd->rnd_nhop; in add_route()
1225 rt->rt_weight = rnd->rnd_weight; in add_route()
1226 rn = rnh->rnh_addaddr(rt_key(rt), rt_mask_const(rt), &rnh->head, rt->rt_nodes); in add_route()
1230 tmproutes_update(rnh, rt, rnd->rnd_nhop); in add_route()
1237 rc->rc_rt = rt; in add_route()
1254 delete_route(struct rib_head *rnh, struct rtentry *rt, struct rib_cmd_info *rc) in delete_route() argument
1261 rn = rnh->rnh_deladdr(rt_key_const(rt), rt_mask_const(rt), &rnh->head); in delete_route()
1264 rt = RNTORT(rn); in delete_route()
1265 rt->rte_flags &= ~RTF_UP; in delete_route()
1271 rc->rc_rt = rt; in delete_route()
1272 rc->rc_nh_old = rt->rt_nhop; in delete_route()
1274 rc->rc_nh_weight = rt->rt_weight; in delete_route()
1286 change_route(struct rib_head *rnh, struct rtentry *rt, in change_route() argument
1293 nh_orig = rt->rt_nhop; in change_route()
1296 return (delete_route(rnh, rt, rc)); in change_route()
1299 rt->rt_nhop = rnd->rnd_nhop; in change_route()
1300 rt->rt_weight = rnd->rnd_weight; in change_route()
1302 tmproutes_update(rnh, rt, rnd->rnd_nhop); in change_route()
1307 rc->rc_rt = rt; in change_route()
1323 change_route_conditional(struct rib_head *rnh, struct rtentry *rt, in change_route_conditional() argument
1340 rt_new = lookup_prefix_rt(rnh, rt, &rnd); in change_route_conditional()
1344 error = add_route(rnh, rt, rnd_new, rc); in change_route_conditional()
1434 struct rtentry *rt = (struct rtentry *)rn; in rt_checkdelroute() local
1436 if (rt_delete_conditional(di->rnh, rt, di->prio, in rt_checkdelroute()
1449 rt->rt_chain = di->head; in rt_checkdelroute()
1450 di->head = rt; in rt_checkdelroute()
1478 struct rtentry *rt; in rib_walk_del() local
1503 rt = di.head; in rib_walk_del()
1504 di.head = rt->rt_chain; in rib_walk_del()
1505 rt->rt_chain = NULL; in rib_walk_del()
1506 nh = rt->rt_nhop; in rib_walk_del()
1508 di.rc.rc_rt = rt; in rib_walk_del()
1521 rt_routemsg(RTM_DELETE, rt, wn[i].nh, fibnum); in rib_walk_del()
1524 rt_routemsg(RTM_DELETE, rt, nh, fibnum); in rib_walk_del()
1526 rt_free(rt); in rib_walk_del()
1535 struct rtentry *rt = RNTORT(rn); in rt_delete_unconditional() local
1538 rn = rnh->rnh_deladdr(rt_key(rt), rt_mask(rt), &rnh->head); in rt_delete_unconditional()
1539 if (RNTORT(rn) == rt) in rt_delete_unconditional()
1540 rt_free(rt); in rt_delete_unconditional()