- dslite_main_t *dm = &dslite_main;
-
- sm->deterministic = 0;
- sm->out2in_dpo = 0;
- sm->endpoint_dependent = 0;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat
- (input, "translation hash buckets %d", &translation_buckets))
- ;
- else if (unformat (input, "translation hash memory %d",
- &translation_memory_size));
- else if (unformat (input, "user hash buckets %d", &user_buckets))
- ;
- else if (unformat (input, "user hash memory %d", &user_memory_size))
- ;
- else if (unformat (input, "max translations per user %d",
- &max_translations_per_user))
- ;
- else if (unformat (input, "outside VRF id %d", &outside_vrf_id))
- ;
- else if (unformat (input, "outside ip6 VRF id %d", &outside_ip6_vrf_id))
- ;
- else if (unformat (input, "inside VRF id %d", &inside_vrf_id))
- ;
- else if (unformat (input, "static mapping only"))
- {
- static_mapping_only = 1;
- if (unformat (input, "connection tracking"))
- static_mapping_connection_tracking = 1;
- }
- else if (unformat (input, "deterministic"))
- sm->deterministic = 1;
- else if (unformat (input, "nat64 bib hash buckets %d",
- &nat64_bib_buckets))
- ;
- else if (unformat (input, "nat64 bib hash memory %d",
- &nat64_bib_memory_size))
- ;
- else
- if (unformat (input, "nat64 st hash buckets %d", &nat64_st_buckets))
- ;
- else if (unformat (input, "nat64 st hash memory %d",
- &nat64_st_memory_size))
- ;
- else if (unformat (input, "out2in dpo"))
- sm->out2in_dpo = 1;
- else if (unformat (input, "dslite ce"))
- dslite_set_ce (dm, 1);
- else if (unformat (input, "endpoint-dependent"))
- sm->endpoint_dependent = 1;
- else
- return clib_error_return (0, "unknown input '%U'",
- format_unformat_error, input);
- }
-
- if (sm->deterministic && sm->endpoint_dependent)
- return clib_error_return (0,
- "deterministic and endpoint-dependent modes are mutually exclusive");
-
- if (static_mapping_only && (sm->deterministic || sm->endpoint_dependent))
- return clib_error_return (0,
- "static mapping only mode available only for simple nat");
-
- if (sm->out2in_dpo && (sm->deterministic || sm->endpoint_dependent))
- return clib_error_return (0,
- "out2in dpo mode available only for simple nat");
-
- /* for show commands, etc. */
- sm->translation_buckets = translation_buckets;
- sm->translation_memory_size = translation_memory_size;
- /* do not exceed load factor 10 */
- sm->max_translations = 10 * translation_buckets;
- sm->user_buckets = user_buckets;
- sm->user_memory_size = user_memory_size;
- sm->max_translations_per_user = max_translations_per_user;
- sm->outside_vrf_id = outside_vrf_id;
- sm->outside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
- outside_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
- nm->outside_vrf_id = outside_ip6_vrf_id;
- nm->outside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
- outside_ip6_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
- sm->inside_vrf_id = inside_vrf_id;
- sm->inside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
- inside_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
- sm->static_mapping_only = static_mapping_only;
- sm->static_mapping_connection_tracking = static_mapping_connection_tracking;
-
- nat64_set_hash (nat64_bib_buckets, nat64_bib_memory_size, nat64_st_buckets,
- nat64_st_memory_size);
-
- if (sm->deterministic)
- {
- sm->in2out_node_index = snat_det_in2out_node.index;
- sm->in2out_output_node_index = ~0;
- sm->out2in_node_index = snat_det_out2in_node.index;
- sm->icmp_match_in2out_cb = icmp_match_in2out_det;
- sm->icmp_match_out2in_cb = icmp_match_out2in_det;
- }
- else