linux-cp: check if lcp_itf_pair exists before creating tap

Now we create tun/tap and then check whether lcp_itf_pair was already
created. Move the check in the beginning.

Type: fix

Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com>
Change-Id: I848685a9cfdbe92a5e38ecb8e5d5322262b4e384
This commit is contained in:
Stanislav Zaikin
2023-09-05 10:40:07 +02:00
committed by Matthew Smith
parent 8a92b68bc8
commit a164636106

View File

@@ -782,6 +782,15 @@ lcp_itf_pair_create (u32 phy_sw_if_index, u8 *host_if_name,
const vnet_sw_interface_t *sw;
const vnet_hw_interface_t *hw;
const lcp_itf_pair_t *lip;
index_t lipi;
lipi = lcp_itf_pair_find_by_phy (phy_sw_if_index);
if (lipi != INDEX_INVALID)
{
LCP_ITF_PAIR_ERR ("pair_create: already created");
return VNET_API_ERROR_VALUE_EXIST;
}
if (!vnet_sw_if_index_is_api_valid (phy_sw_if_index))
{