- errmsg ("dst (mac address) not set\n");
- return -99;
- }
- if (!tx_sw_if_index_set)
- {
- errmsg ("tx-intfc not set\n");
- return -99;
- }
-
- M (MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel);
-
- mp->vrf_id = ntohl (inner_vrf_id);
- clib_memcpy (mp->adj_address, &intfc_address, sizeof (intfc_address));
- mp->adj_address_length = intfc_address_length;
- clib_memcpy (mp->dst_mac_address, dst_mac_address,
- sizeof (dst_mac_address));
- mp->tx_sw_if_index = ntohl (tx_sw_if_index);
- mp->l2_only = l2_only;
- mp->is_add = is_add;
-
- S;
- W;
- /* NOTREACHED */
- return 0;
-}
-
-static int
-api_mpls_ethernet_add_del_tunnel_2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_mpls_ethernet_add_del_tunnel_2_t *mp;
- f64 timeout;
- u32 inner_vrf_id = 0;
- u32 outer_vrf_id = 0;
- ip4_address_t adj_address;
- int adj_address_set = 0;
- ip4_address_t next_hop_address;
- int next_hop_address_set = 0;
- u32 tmp;
- u8 adj_address_length = 0;
- u8 l2_only = 0;
- u8 is_add = 1;
- u32 resolve_attempts = 5;
- u8 resolve_if_needed = 1;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "inner_vrf_id %d", &inner_vrf_id))
- ;
- else if (unformat (i, "outer_vrf_id %d", &outer_vrf_id))
- ;
- else if (unformat (i, "adj %U/%d", unformat_ip4_address,
- &adj_address, &tmp))
- {
- adj_address_length = tmp;
- adj_address_set = 1;
- }
- else if (unformat (i, "next-hop %U", unformat_ip4_address,
- &next_hop_address))
- next_hop_address_set = 1;
- else if (unformat (i, "resolve-attempts %d", &resolve_attempts))
- ;
- else if (unformat (i, "resolve-if-needed %d", &tmp))
- resolve_if_needed = tmp;
- else if (unformat (i, "l2-only"))
- l2_only = 1;
- else if (unformat (i, "del"))
- is_add = 0;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!adj_address_set)
- {
- errmsg ("adjacency address/mask not set\n");
- return -99;
- }
- if (!next_hop_address_set)
- {
- errmsg ("ip4 next hop address (in outer fib) not set\n");
- return -99;
- }
-
- M (MPLS_ETHERNET_ADD_DEL_TUNNEL_2, mpls_ethernet_add_del_tunnel_2);
-
- mp->inner_vrf_id = ntohl (inner_vrf_id);
- mp->outer_vrf_id = ntohl (outer_vrf_id);
- mp->resolve_attempts = ntohl (resolve_attempts);
- mp->resolve_if_needed = resolve_if_needed;
- mp->is_add = is_add;
- mp->l2_only = l2_only;
- clib_memcpy (mp->adj_address, &adj_address, sizeof (adj_address));
- mp->adj_address_length = adj_address_length;
- clib_memcpy (mp->next_hop_ip4_address_in_outer_vrf, &next_hop_address,
- sizeof (next_hop_address));
-
- S;
- W;
- /* NOTREACHED */
- return 0;
-}
-
-static int
-api_sw_interface_set_unnumbered (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sw_interface_set_unnumbered_t *mp;
- f64 timeout;
- u32 sw_if_index;
- u32 unnum_sw_index = ~0;
- u8 is_add = 1;
- u8 sw_if_index_set = 0;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "unnum_if_index %d", &unnum_sw_index))
- ;
- else if (unformat (i, "del"))
- is_add = 0;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing interface name or sw_if_index\n");