diff options
Diffstat (limited to 'plugins/lb-plugin/lb')
-rw-r--r-- | plugins/lb-plugin/lb/lb.c | 214 | ||||
-rw-r--r-- | plugins/lb-plugin/lb/node.c | 58 |
2 files changed, 136 insertions, 136 deletions
diff --git a/plugins/lb-plugin/lb/lb.c b/plugins/lb-plugin/lb/lb.c index e91bdf0bc10..140c221a438 100644 --- a/plugins/lb-plugin/lb/lb.c +++ b/plugins/lb-plugin/lb/lb.c @@ -537,54 +537,54 @@ int lb_vip_del_ass(u32 vip_index, ip46_address_t *addresses, u32 n) int lb_as_lookup_bypass(u32 vip_index, ip46_address_t *address, u8 is_disable) { - lb_get_writer_lock(); - lb_main_t *lbm = &lb_main; - u32 as_index; - lb_as_t *as; - lb_vip_t *vip; - - if (!(vip = lb_vip_get_by_index(vip_index)) || - lb_as_find_index_vip(vip, address, &as_index)) { - lb_put_writer_lock(); - return VNET_API_ERROR_NO_SUCH_ENTRY; - } - - as = &lbm->ass[as_index]; - - if (is_disable) { - as->adj_index = ~0; - } else if (lb_vip_is_gre4(vip)) { - uword *p = ip4_get_route (&ip4_main, 0, 0, as->address.ip4.as_u8, 32); - if (p == 0) { - lb_put_writer_lock(); - return VNET_API_ERROR_NO_SUCH_ENTRY; - } - u32 ai = (u32)p[0]; - ip_lookup_main_t *lm4 = &ip4_main.lookup_main; - ip_adjacency_t *adj4 = ip_get_adjacency (lm4, ai); - if (adj4->lookup_next_index != IP_LOOKUP_NEXT_REWRITE) { - lb_put_writer_lock(); - return VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE; - } - - as->adj_index = ai; - } else { - u32 ai = ip6_get_route (&ip6_main, 0, 0, &as->address.ip6, 128); - if (ai == 0) { - lb_put_writer_lock(); - return VNET_API_ERROR_NO_SUCH_ENTRY; - } - - ip_lookup_main_t *lm6 = &ip6_main.lookup_main; - ip_adjacency_t *adj6 = ip_get_adjacency (lm6, ai); - if (adj6->lookup_next_index != IP_LOOKUP_NEXT_REWRITE) { - lb_put_writer_lock(); - return VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE; - } - - as->adj_index = ai; - } - lb_put_writer_lock(); + /* lb_get_writer_lock(); */ + /* lb_main_t *lbm = &lb_main; */ + /* u32 as_index; */ + /* lb_as_t *as; */ + /* lb_vip_t *vip; */ + + /* if (!(vip = lb_vip_get_by_index(vip_index)) || */ + /* lb_as_find_index_vip(vip, address, &as_index)) { */ + /* lb_put_writer_lock(); */ + /* return VNET_API_ERROR_NO_SUCH_ENTRY; */ + /* } */ + + /* as = &lbm->ass[as_index]; */ + + /* if (is_disable) { */ + /* as->adj_index = ~0; */ + /* } else if (lb_vip_is_gre4(vip)) { */ + /* uword *p = ip4_get_route (&ip4_main, 0, 0, as->address.ip4.as_u8, 32); */ + /* if (p == 0) { */ + /* lb_put_writer_lock(); */ + /* return VNET_API_ERROR_NO_SUCH_ENTRY; */ + /* } */ + /* u32 ai = (u32)p[0]; */ + /* ip_lookup_main_t *lm4 = &ip4_main.lookup_main; */ + /* ip_adjacency_t *adj4 = ip_get_adjacency (lm4, ai); */ + /* if (adj4->lookup_next_index != IP_LOOKUP_NEXT_REWRITE) { */ + /* lb_put_writer_lock(); */ + /* return VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE; */ + /* } */ + + /* as->adj_index = ai; */ + /* } else { */ + /* u32 ai = ip6_get_route (&ip6_main, 0, 0, &as->address.ip6, 128); */ + /* if (ai == 0) { */ + /* lb_put_writer_lock(); */ + /* return VNET_API_ERROR_NO_SUCH_ENTRY; */ + /* } */ + + /* ip_lookup_main_t *lm6 = &ip6_main.lookup_main; */ + /* ip_adjacency_t *adj6 = ip_get_adjacency (lm6, ai); */ + /* if (adj6->lookup_next_index != IP_LOOKUP_NEXT_REWRITE) { */ + /* lb_put_writer_lock(); */ + /* return VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE; */ + /* } */ + + /* as->adj_index = ai; */ + /* } */ + /* lb_put_writer_lock(); */ return 0; } @@ -594,41 +594,41 @@ int lb_as_lookup_bypass(u32 vip_index, ip46_address_t *address, u8 is_disable) */ static void lb_vip_add_adjacency(lb_main_t *lbm, lb_vip_t *vip) { - ip_adjacency_t adj; - //Adjacency - memset (&adj, 0, sizeof (adj)); - adj.explicit_fib_index = ~0; - lb_adj_data_t *ad = (lb_adj_data_t *) &adj.opaque; - ad->vip_index = vip - lbm->vips; - - ASSERT (lbm->writer_lock[0]); //This must be called with the lock owned - u32 lookup_next_index = lbm->ip_lookup_next_index[vip->type]; - - if (lb_vip_is_ip4(vip)) { - adj.lookup_next_index = lookup_next_index; - ip4_add_del_route_args_t route_args = {}; - ip4_main_t *im4 = &ip4_main; - route_args.table_index_or_table_id = 0; - route_args.flags = IP4_ROUTE_FLAG_ADD; - route_args.dst_address = vip->prefix.ip4; - route_args.dst_address_length = vip->plen - 96; - route_args.adj_index = ~0; - route_args.add_adj = &adj; - route_args.n_add_adj = 1; - ip4_add_del_route (im4, &route_args); - } else { - adj.lookup_next_index = lookup_next_index; - ip6_add_del_route_args_t route_args = {}; - ip6_main_t *im6 = &ip6_main; - route_args.table_index_or_table_id = 0; - route_args.flags = IP6_ROUTE_FLAG_ADD; - route_args.dst_address = vip->prefix.ip6; - route_args.dst_address_length = vip->plen; - route_args.adj_index = ~0; - route_args.add_adj = &adj; - route_args.n_add_adj = 1; - ip6_add_del_route (im6, &route_args); - } + /* ip_adjacency_t adj; */ + /* //Adjacency */ + /* memset (&adj, 0, sizeof (adj)); */ + /* adj.explicit_fib_index = ~0; */ + /* lb_adj_data_t *ad = (lb_adj_data_t *) &adj.opaque; */ + /* ad->vip_index = vip - lbm->vips; */ + + /* ASSERT (lbm->writer_lock[0]); //This must be called with the lock owned */ + /* u32 lookup_next_index = lbm->ip_lookup_next_index[vip->type]; */ + + /* if (lb_vip_is_ip4(vip)) { */ + /* adj.lookup_next_index = lookup_next_index; */ + /* ip4_add_del_route_args_t route_args = {}; */ + /* ip4_main_t *im4 = &ip4_main; */ + /* route_args.table_index_or_table_id = 0; */ + /* route_args.flags = IP4_ROUTE_FLAG_ADD; */ + /* route_args.dst_address = vip->prefix.ip4; */ + /* route_args.dst_address_length = vip->plen - 96; */ + /* route_args.adj_index = ~0; */ + /* route_args.add_adj = &adj; */ + /* route_args.n_add_adj = 1; */ + /* ip4_add_del_route (im4, &route_args); */ + /* } else { */ + /* adj.lookup_next_index = lookup_next_index; */ + /* ip6_add_del_route_args_t route_args = {}; */ + /* ip6_main_t *im6 = &ip6_main; */ + /* route_args.table_index_or_table_id = 0; */ + /* route_args.flags = IP6_ROUTE_FLAG_ADD; */ + /* route_args.dst_address = vip->prefix.ip6; */ + /* route_args.dst_address_length = vip->plen; */ + /* route_args.adj_index = ~0; */ + /* route_args.add_adj = &adj; */ + /* route_args.n_add_adj = 1; */ + /* ip6_add_del_route (im6, &route_args); */ + /* } */ } /** @@ -636,30 +636,30 @@ static void lb_vip_add_adjacency(lb_main_t *lbm, lb_vip_t *vip) */ static void lb_vip_del_adjacency(lb_main_t *lbm, lb_vip_t *vip) { - ASSERT (lbm->writer_lock[0]); //This must be called with the lock owned - if (lb_vip_is_ip4(vip)) { - ip4_main_t *im4 = &ip4_main; - ip4_add_del_route_args_t route_args = {}; - route_args.table_index_or_table_id = 0; - route_args.flags = IP4_ROUTE_FLAG_DEL; - route_args.dst_address = vip->prefix.ip4; - route_args.dst_address_length = vip->plen - 96; - route_args.adj_index = ~0; - route_args.add_adj = NULL; - route_args.n_add_adj = 0; - ip4_add_del_route (im4, &route_args); - } else { - ip6_main_t *im6 = &ip6_main; - ip6_add_del_route_args_t route_args = {}; - route_args.table_index_or_table_id = 0; - route_args.flags = IP6_ROUTE_FLAG_DEL; - route_args.dst_address = vip->prefix.ip6; - route_args.dst_address_length = vip->plen; - route_args.adj_index = ~0; - route_args.add_adj = NULL; - route_args.n_add_adj = 0; - ip6_add_del_route (im6, &route_args); - } + /* ASSERT (lbm->writer_lock[0]); //This must be called with the lock owned */ + /* if (lb_vip_is_ip4(vip)) { */ + /* ip4_main_t *im4 = &ip4_main; */ + /* ip4_add_del_route_args_t route_args = {}; */ + /* route_args.table_index_or_table_id = 0; */ + /* route_args.flags = IP4_ROUTE_FLAG_DEL; */ + /* route_args.dst_address = vip->prefix.ip4; */ + /* route_args.dst_address_length = vip->plen - 96; */ + /* route_args.adj_index = ~0; */ + /* route_args.add_adj = NULL; */ + /* route_args.n_add_adj = 0; */ + /* ip4_add_del_route (im4, &route_args); */ + /* } else { */ + /* ip6_main_t *im6 = &ip6_main; */ + /* ip6_add_del_route_args_t route_args = {}; */ + /* route_args.table_index_or_table_id = 0; */ + /* route_args.flags = IP6_ROUTE_FLAG_DEL; */ + /* route_args.dst_address = vip->prefix.ip6; */ + /* route_args.dst_address_length = vip->plen; */ + /* route_args.adj_index = ~0; */ + /* route_args.add_adj = NULL; */ + /* route_args.n_add_adj = 0; */ + /* ip6_add_del_route (im6, &route_args); */ + /* } */ } int lb_vip_add(ip46_address_t *prefix, u8 plen, lb_vip_type_t type, u32 new_length, u32 *vip_index) diff --git a/plugins/lb-plugin/lb/node.c b/plugins/lb-plugin/lb/node.c index 8df462c0853..4f71616120e 100644 --- a/plugins/lb-plugin/lb/node.c +++ b/plugins/lb-plugin/lb/node.c @@ -48,15 +48,15 @@ typedef struct { u32 as_index; } lb_trace_t; -u8 *lb_format_adjacency(u8 * s, va_list * va) -{ - lb_main_t *lbm = &lb_main; - __attribute((unused)) ip_lookup_main_t *lm = va_arg (*va, ip_lookup_main_t *); - ip_adjacency_t *adj = va_arg (*va, ip_adjacency_t *); - lb_adj_data_t *ad = (lb_adj_data_t *) &adj->opaque; - __attribute__((unused)) lb_vip_t *vip = pool_elt_at_index (lbm->vips, ad->vip_index); - return format(s, "vip idx:%d", ad->vip_index); -} +/* u8 *lb_format_adjacency(u8 * s, va_list * va) */ +/* { */ +/* lb_main_t *lbm = &lb_main; */ +/* __attribute((unused)) ip_lookup_main_t *lm = va_arg (*va, ip_lookup_main_t *); */ +/* ip_adjacency_t *adj = va_arg (*va, ip_adjacency_t *); */ +/* lb_adj_data_t *ad = (lb_adj_data_t *) &adj->opaque; */ +/* __attribute__((unused)) lb_vip_t *vip = pool_elt_at_index (lbm->vips, ad->vip_index); */ +/* return format(s, "vip idx:%d", ad->vip_index); */ +/* } */ u8 * format_lb_trace (u8 * s, va_list * args) @@ -319,11 +319,11 @@ VLIB_REGISTER_NODE (lb6_gre6_node) = }, }; -VNET_IP6_REGISTER_ADJACENCY(lb6_gre6) = { - .node_name = "lb6-gre6", - .fn = lb_format_adjacency, - .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP6_GRE6] -}; +/* VNET_IP6_REGISTER_ADJACENCY(lb6_gre6) = { */ +/* .node_name = "lb6-gre6", */ +/* .fn = lb_format_adjacency, */ +/* .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP6_GRE6] */ +/* }; */ VLIB_REGISTER_NODE (lb6_gre4_node) = { @@ -344,11 +344,11 @@ VLIB_REGISTER_NODE (lb6_gre4_node) = }, }; -VNET_IP6_REGISTER_ADJACENCY(lb6_gre4) = { - .node_name = "lb6-gre4", - .fn = lb_format_adjacency, - .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP6_GRE4] -}; +/* VNET_IP6_REGISTER_ADJACENCY(lb6_gre4) = { */ +/* .node_name = "lb6-gre4", */ +/* .fn = lb_format_adjacency, */ +/* .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP6_GRE4] */ +/* }; */ VLIB_REGISTER_NODE (lb4_gre6_node) = { @@ -369,11 +369,11 @@ VLIB_REGISTER_NODE (lb4_gre6_node) = }, }; -VNET_IP4_REGISTER_ADJACENCY(lb4_gre6) = { - .node_name = "lb4-gre6", - .fn = lb_format_adjacency, - .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP4_GRE6] -}; +/* VNET_IP4_REGISTER_ADJACENCY(lb4_gre6) = { */ +/* .node_name = "lb4-gre6", */ +/* .fn = lb_format_adjacency, */ +/* .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP4_GRE6] */ +/* }; */ VLIB_REGISTER_NODE (lb4_gre4_node) = { @@ -394,8 +394,8 @@ VLIB_REGISTER_NODE (lb4_gre4_node) = }, }; -VNET_IP4_REGISTER_ADJACENCY(lb4_gre4) = { - .node_name = "lb4-gre4", - .fn = lb_format_adjacency, - .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP4_GRE4] -}; +/* VNET_IP4_REGISTER_ADJACENCY(lb4_gre4) = { */ +/* .node_name = "lb4-gre4", */ +/* .fn = lb_format_adjacency, */ +/* .next_index = &lb_main.ip_lookup_next_index[LB_VIP_TYPE_IP4_GRE4] */ +/* }; */ |