This gives a lot of operational problems later. It's definitely reasonable to be able to create tap interfaces in other namespaces, and this is still possible (see below for syntax). However, changing the runtime netns makes the netlink listener much more complicated because it will have to listen on not just one netns, but all of them, for netlink updates. So, for now, let's remove the ability to set the namespace in the API. Still possible: - set at startup.conf in lcpng { netns <x> } - force creating in 'lcpng create ... netns <x>' This will nudge folks to create one singular namespace (say, 'dataplane', in the startup.conf), and then handle all netlink messages in that namespace only.
183 lines
4.7 KiB
C
183 lines
4.7 KiB
C
/* Hey Emacs use -*- mode: C -*- */
|
|
/*
|
|
* Linux Control Plane API
|
|
*
|
|
* Copyright 2020 Rubicon Communications, LLC.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at:
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
option version = "1.0.0";
|
|
|
|
import "vnet/interface_types.api";
|
|
|
|
/** \brief Set the namespace for Linux Control Plane host taps
|
|
@param client_index - opaque cookie to identify the sender
|
|
@param context - sender context, to match reply w/ request
|
|
@param namespace - the new namespace; namespace[0] == 0 iff none
|
|
*/
|
|
autoreply define lcp_netns_set
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
string namespace[32]; /* LCP_NS_LEN */
|
|
};
|
|
|
|
/** \brief get the Linux Control Plane namespace
|
|
@param client_index - opaque cookie to identify the sender
|
|
@param context - sender context, to match reply w/ request
|
|
*/
|
|
define lcp_netns_get
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
};
|
|
|
|
/** \brief get the Linux Control Plane namespace
|
|
@param client_index - opaque cookie to identify the sender
|
|
@param context - sender context, to match reply w/ request
|
|
@param namespace - the namespace; namespace[0] == 0 iff none
|
|
*/
|
|
define lcp_netns_get_reply
|
|
{
|
|
u32 context;
|
|
string namespace[32]; /* LCP_NS_LEN */
|
|
};
|
|
|
|
enum lcp_itf_host_type : u8
|
|
{
|
|
LCP_API_ITF_HOST_TAP = 0,
|
|
LCP_API_ITF_HOST_TUN = 1,
|
|
};
|
|
|
|
/** \brief Add or delete a Linux Conrol Plane interface pair
|
|
@param client_index - opaque cookie to identify the sender
|
|
@param context - sender context, to match reply w/ request
|
|
@param is_add - 0 if deleting, != 0 if adding
|
|
@param sw_if_index - index of VPP PHY SW interface
|
|
@param host_if_name - host tap interface name
|
|
@param host_if_type - the type of host interface to create (tun, tap)
|
|
@param namespace - optional tap namespace; namespace[0] == 0 iff none
|
|
*/
|
|
autoreply autoendian define lcp_itf_pair_add_del
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
bool is_add;
|
|
vl_api_interface_index_t sw_if_index;
|
|
string host_if_name[16]; /* IFNAMSIZ */
|
|
vl_api_lcp_itf_host_type_t host_if_type;
|
|
string namespace[32]; /* LCP_NS_LEN */
|
|
};
|
|
autoendian define lcp_itf_pair_add_del_v2
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
bool is_add;
|
|
vl_api_interface_index_t sw_if_index;
|
|
string host_if_name[16]; /* IFNAMSIZ */
|
|
vl_api_lcp_itf_host_type_t host_if_type;
|
|
string namespace[32]; /* LCP_NS_LEN */
|
|
};
|
|
define lcp_itf_pair_add_del_v2_reply
|
|
{
|
|
u32 context;
|
|
i32 retval;
|
|
vl_api_interface_index_t host_sw_if_index;
|
|
};
|
|
|
|
/** \brief Dump Linux Control Plane interface pair data
|
|
@param client_index - opaque cookie to identify the sender
|
|
@param context - sender context, to match reply w/ request
|
|
@param sw_if_index - interface to use as filter (~0 == "all")
|
|
*/
|
|
define lcp_itf_pair_get
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
u32 cursor;
|
|
};
|
|
define lcp_itf_pair_get_reply
|
|
{
|
|
u32 context;
|
|
i32 retval;
|
|
u32 cursor;
|
|
};
|
|
|
|
/** \brief Linux Control Plane interface pair dump response
|
|
@param context - sender context which was passed in the request
|
|
@param phy_sw_if_index - VPP's sw_if_index for the PHY
|
|
@param host_sw_if_index - VPP's sw_if_index for the host tap
|
|
@param vif_index - tap linux index
|
|
@param host_if_name - host interface name
|
|
@param host_if_type - host interface type (tun, tap)
|
|
@param namespace - host interface namespace
|
|
*/
|
|
autoendian define lcp_itf_pair_details
|
|
{
|
|
u32 context;
|
|
vl_api_interface_index_t phy_sw_if_index;
|
|
vl_api_interface_index_t host_sw_if_index;
|
|
u32 vif_index;
|
|
string host_if_name[16]; /* IFNAMSIZ */
|
|
vl_api_lcp_itf_host_type_t host_if_type;
|
|
string namespace[32]; /* LCP_NS_LEN */
|
|
};
|
|
|
|
service {
|
|
rpc lcp_itf_pair_get returns lcp_itf_pair_get_reply
|
|
stream lcp_itf_pair_details;
|
|
};
|
|
|
|
/** \brief Replace end/begin
|
|
*/
|
|
autoreply define lcp_itf_pair_replace_begin
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
};
|
|
autoreply define lcp_itf_pair_replace_end
|
|
{
|
|
u32 client_index;
|
|
u32 context;
|
|
};
|
|
|
|
/*
|
|
* Linux-CP Error counters/messages
|
|
*/
|
|
counters linuxcp {
|
|
packets {
|
|
severity info;
|
|
type counter64;
|
|
units "packets";
|
|
description "ARP packets processed";
|
|
};
|
|
copies {
|
|
severity info;
|
|
type counter64;
|
|
units "packets";
|
|
description "ARP replies copied to host";
|
|
};
|
|
};
|
|
|
|
paths {
|
|
"/err/lcpng-arp-phy" "lcpng";
|
|
"/err/lcpng-arp-host" "lcpng";
|
|
};
|
|
|
|
/*
|
|
* Local Variables:
|
|
* eval: (c-set-style "gnu")
|
|
* End:
|
|
*/
|