diff options
author | Stanislav Zaikin <stanislav.zaikin@46labs.com> | 2023-04-04 10:26:39 +0200 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2023-04-11 22:40:21 +0000 |
commit | fdf917e8f8dd5abb3f9263c9cb3fd9ce00563b60 (patch) | |
tree | 338b7e6fafba643eb17178a5ffc6b2d6d7ebbd7b /src/plugins/linux-cp/lcp_interface.c | |
parent | 00f5d96f04337dce0a24fdf0da06f5991c981e46 (diff) |
linux-cp: don't create tap for non-eth ifaces
Creation of lcp tap for non-ethernet interfaces can potentially lead to a crash, so avoid it.
Type: fix
Change-Id: I76ded8a08ea38a2c31d0215804af023207d4d3e1
Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com>
Diffstat (limited to 'src/plugins/linux-cp/lcp_interface.c')
-rw-r--r-- | src/plugins/linux-cp/lcp_interface.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/linux-cp/lcp_interface.c b/src/plugins/linux-cp/lcp_interface.c index eef06ecfa19..fab048a7773 100644 --- a/src/plugins/linux-cp/lcp_interface.c +++ b/src/plugins/linux-cp/lcp_interface.c @@ -805,6 +805,14 @@ lcp_itf_pair_create (u32 phy_sw_if_index, u8 *host_if_name, return VNET_API_ERROR_INVALID_SW_IF_INDEX; } + if (hw->hw_class_index != ethernet_hw_interface_class.index && + host_if_type == LCP_ITF_HOST_TAP) + { + LCP_ITF_PAIR_ERR ( + "pair_create: don't create TAP for non-eth interface; use tun"); + return VNET_API_ERROR_INVALID_ARGUMENT; + } + /* * Use interface-specific netns if supplied. * Otherwise, use netns if defined, otherwise use the OS default. |