diff options
author | Stanislav Zaikin <stanislav.zaikin@46labs.com> | 2023-09-05 10:40:07 +0200 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2023-10-13 20:45:57 +0000 |
commit | a16463610639a22d470c2c999ce2a8408a575834 (patch) | |
tree | 4b3ed807748200d82ebd1752e0c94a1201160b6a | |
parent | 8a92b68bc8eaaec48d144fba62490a32f28eb422 (diff) |
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
-rw-r--r-- | src/plugins/linux-cp/lcp_interface.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/linux-cp/lcp_interface.c b/src/plugins/linux-cp/lcp_interface.c index fab048a7773..921dccf5519 100644 --- a/src/plugins/linux-cp/lcp_interface.c +++ b/src/plugins/linux-cp/lcp_interface.c @@ -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)) { |