X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvat%2Fapi_format.c;h=e8d6bd5b1c18970d7cc6fd28ef4ce7eb1dcd461a;hb=c42fc05bfbb26fd11fe92ac9d11587660a817ac1;hp=d39a61a813ae4af82f41a234dd0986642461a776;hpb=91c6ef7cae2d20ca17a69003a44090614412c63f;p=vpp.git diff --git a/src/vat/api_format.c b/src/vat/api_format.c index d39a61a813a..e8d6bd5b1c1 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -7810,8 +7810,11 @@ api_tap_create_v2 (vat_main_t * vam) vl_api_tap_create_v2_t *mp; u8 mac_address[6]; u8 random_mac = 1; - u8 *tap_name = 0; - u8 *host_namespace = 0; + u32 id = ~0; + u8 *host_if_name = 0; + u8 *host_ns = 0; + u8 host_mac_addr[6]; + u8 host_mac_addr_set = 0; u8 *host_bridge = 0; ip4_address_t host_ip4_addr; u32 host_ip4_prefix_len = 0; @@ -7829,10 +7832,15 @@ api_tap_create_v2 (vat_main_t * vam) { random_mac = 0; } - else if (unformat (i, "name %s", &tap_name)) + else if (unformat (i, "id %s", &id)) + ; + else if (unformat (i, "host-if-name %s", &host_if_name)) ; - else if (unformat (i, "host-ns %s", &host_namespace)) + else if (unformat (i, "host-ns %s", &host_ns)) ; + else if (unformat (i, "host-mac-addr %U", unformat_ethernet_address, + host_mac_addr)) + host_mac_addr_set = 1; else if (unformat (i, "host-bridge %s", &host_bridge)) ; else if (unformat (i, "host-ip4-addr %U/%d", unformat_ip4_address, @@ -7849,17 +7857,12 @@ api_tap_create_v2 (vat_main_t * vam) break; } - if (tap_name == 0) - { - errmsg ("missing tap name. "); - return -99; - } - if (vec_len (tap_name) > 63) + if (vec_len (host_if_name) > 63) { errmsg ("tap name too long. "); return -99; } - if (vec_len (host_namespace) > 63) + if (vec_len (host_ns) > 63) { errmsg ("host name space too long. "); return -99; @@ -7900,23 +7903,27 @@ api_tap_create_v2 (vat_main_t * vam) return -99; } - vec_add1 (tap_name, 0); - /* Construct the API message */ M (TAP_CREATE_V2, mp); mp->use_random_mac = random_mac; - clib_memcpy (mp->mac_address, mac_address, 6); - clib_memcpy (mp->tap_name, tap_name, vec_len (tap_name)); - mp->host_namespace_set = host_namespace != 0; + + mp->id = id; + mp->host_namespace_set = host_ns != 0; mp->host_bridge_set = host_bridge != 0; mp->host_ip4_addr_set = host_ip4_prefix_len != 0; mp->host_ip6_addr_set = host_ip6_prefix_len != 0; mp->rx_ring_sz = rx_ring_sz; mp->tx_ring_sz = tx_ring_sz; - if (host_namespace) - clib_memcpy (mp->host_namespace, host_namespace, - vec_len (host_namespace)); + + if (random_mac) + clib_memcpy (mp->mac_address, mac_address, 6); + if (host_mac_addr_set) + clib_memcpy (mp->host_mac_addr, host_mac_addr, 6); + if (host_if_name) + clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name)); + if (host_ns) + clib_memcpy (mp->host_namespace, host_ns, vec_len (host_ns)); if (host_bridge) clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge)); if (host_ip4_prefix_len) @@ -7925,7 +7932,9 @@ api_tap_create_v2 (vat_main_t * vam) clib_memcpy (mp->host_ip6_addr, &host_ip6_addr, 16); - vec_free (tap_name); + vec_free (host_ns); + vec_free (host_if_name); + vec_free (host_bridge); /* send it... */ S (mp); @@ -8033,7 +8042,6 @@ api_ip_add_del_route (vat_main_t * vam) u8 is_ipv6 = 0; u8 is_local = 0, is_drop = 0; u8 is_unreach = 0, is_prohibit = 0; - u8 create_vrf_if_needed = 0; u8 is_add = 1; u32 next_hop_weight = 1; u8 is_multipath = 0; @@ -8127,8 +8135,6 @@ api_ip_add_del_route (vat_main_t * vam) is_multipath = 1; else if (unformat (i, "vrf %d", &vrf_id)) ; - else if (unformat (i, "create-vrf")) - create_vrf_if_needed = 1; else if (unformat (i, "count %d", &count)) ; else if (unformat (i, "lookup-in-vrf %d", &next_hop_table_id)) @@ -8215,7 +8221,6 @@ api_ip_add_del_route (vat_main_t * vam) mp->next_hop_sw_if_index = ntohl (sw_if_index); mp->table_id = ntohl (vrf_id); - mp->create_vrf_if_needed = create_vrf_if_needed; mp->is_add = is_add; mp->is_drop = is_drop; @@ -8328,7 +8333,6 @@ api_ip_mroute_add_del (vat_main_t * vam) u32 sw_if_index = ~0, vrf_id = 0; u8 is_ipv6 = 0; u8 is_local = 0; - u8 create_vrf_if_needed = 0; u8 is_add = 1; u8 address_set = 0; u32 grp_address_length = 0; @@ -8385,8 +8389,6 @@ api_ip_mroute_add_del (vat_main_t * vam) is_add = 1; else if (unformat (i, "vrf %d", &vrf_id)) ; - else if (unformat (i, "create-vrf")) - create_vrf_if_needed = 1; else if (unformat (i, "%U", unformat_mfib_itf_flags, &iflags)) ; else if (unformat (i, "%U", unformat_mfib_entry_flags, &eflags)) @@ -8409,7 +8411,6 @@ api_ip_mroute_add_del (vat_main_t * vam) mp->next_hop_sw_if_index = ntohl (sw_if_index); mp->table_id = ntohl (vrf_id); - mp->create_vrf_if_needed = create_vrf_if_needed; mp->is_add = is_add; mp->is_ipv6 = is_ipv6; @@ -8490,7 +8491,6 @@ api_mpls_route_add_del (vat_main_t * vam) unformat_input_t *i = vam->input; vl_api_mpls_route_add_del_t *mp; u32 sw_if_index = ~0, table_id = 0; - u8 create_table_if_needed = 0; u8 is_add = 1; u32 next_hop_weight = 1; u8 is_multipath = 0; @@ -8540,8 +8540,6 @@ api_mpls_route_add_del (vat_main_t * vam) } else if (unformat (i, "weight %d", &next_hop_weight)) ; - else if (unformat (i, "create-table")) - create_table_if_needed = 1; else if (unformat (i, "classify %d", &classify_table_index)) { is_classify = 1; @@ -8609,7 +8607,6 @@ api_mpls_route_add_del (vat_main_t * vam) mp->mr_next_hop_sw_if_index = ntohl (sw_if_index); mp->mr_table_id = ntohl (table_id); - mp->mr_create_table_if_needed = create_table_if_needed; mp->mr_is_add = is_add; mp->mr_next_hop_proto = next_hop_proto; @@ -8715,7 +8712,6 @@ api_mpls_ip_bind_unbind (vat_main_t * vam) unformat_input_t *i = vam->input; vl_api_mpls_ip_bind_unbind_t *mp; u32 ip_table_id = 0; - u8 create_table_if_needed = 0; u8 is_bind = 1; u8 is_ip4 = 1; ip4_address_t v4_address; @@ -8742,8 +8738,6 @@ api_mpls_ip_bind_unbind (vat_main_t * vam) } else if (unformat (i, "%d", &local_label)) ; - else if (unformat (i, "create-table")) - create_table_if_needed = 1; else if (unformat (i, "table-id %d", &ip_table_id)) ; else if (unformat (i, "unbind")) @@ -8772,7 +8766,6 @@ api_mpls_ip_bind_unbind (vat_main_t * vam) /* Construct the API message */ M (MPLS_IP_BIND_UNBIND, mp); - mp->mb_create_table_if_needed = create_table_if_needed; mp->mb_is_bind = is_bind; mp->mb_is_ip4 = is_ip4; mp->mb_ip_table_id = ntohl (ip_table_id);