linux-cp: change namespace to netns
namespace is a keyword for c++ compilers Type: fix Change-Id: Ia8fc9ef1cc15fe9d0e40b3f543f9e8f411203b89 Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com>
This commit is contained in:
committed by
Matthew Smith
parent
eccb5c21cc
commit
3f245e687c
@@ -21,20 +21,20 @@ option version = "1.0.0";
|
|||||||
|
|
||||||
import "vnet/interface_types.api";
|
import "vnet/interface_types.api";
|
||||||
|
|
||||||
/** \brief Set the default Linux Control Plane namespace
|
/** \brief Set the default Linux Control Plane netns
|
||||||
@param client_index - opaque cookie to identify the sender
|
@param client_index - opaque cookie to identify the sender
|
||||||
@param context - sender context, to match reply w/ request
|
@param context - sender context, to match reply w/ request
|
||||||
@param namespace - the new default namespace; namespace[0] == 0 iff none
|
@param netns - the new default netns; netns[0] == 0 if none
|
||||||
*/
|
*/
|
||||||
autoreply define lcp_default_ns_set
|
autoreply define lcp_default_ns_set
|
||||||
{
|
{
|
||||||
u32 client_index;
|
u32 client_index;
|
||||||
u32 context;
|
u32 context;
|
||||||
string namespace[32]; /* LCP_NS_LEN */
|
string netns[32]; /* LCP_NS_LEN */
|
||||||
option in_progress;
|
option in_progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief get the default Linux Control Plane namespace
|
/** \brief get the default Linux Control Plane netns
|
||||||
@param client_index - opaque cookie to identify the sender
|
@param client_index - opaque cookie to identify the sender
|
||||||
@param context - sender context, to match reply w/ request
|
@param context - sender context, to match reply w/ request
|
||||||
*/
|
*/
|
||||||
@@ -44,15 +44,15 @@ define lcp_default_ns_get
|
|||||||
u32 context;
|
u32 context;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief get the default Linux Control Plane namespace
|
/** \brief get the default Linux Control Plane netns
|
||||||
@param client_index - opaque cookie to identify the sender
|
@param client_index - opaque cookie to identify the sender
|
||||||
@param context - sender context, to match reply w/ request
|
@param context - sender context, to match reply w/ request
|
||||||
@param namespace - the default namespace; namespace[0] == 0 iff none
|
@param netns - the default netns; netns[0] == 0 if none
|
||||||
*/
|
*/
|
||||||
define lcp_default_ns_get_reply
|
define lcp_default_ns_get_reply
|
||||||
{
|
{
|
||||||
u32 context;
|
u32 context;
|
||||||
string namespace[32]; /* LCP_NS_LEN */
|
string netns[32]; /* LCP_NS_LEN */
|
||||||
option in_progress;
|
option in_progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ enum lcp_itf_host_type : u8
|
|||||||
@param sw_if_index - index of VPP PHY SW interface
|
@param sw_if_index - index of VPP PHY SW interface
|
||||||
@param host_if_name - host tap interface name
|
@param host_if_name - host tap interface name
|
||||||
@param host_if_type - the type of host interface to create (tun, tap)
|
@param host_if_type - the type of host interface to create (tun, tap)
|
||||||
@param namespace - optional tap namespace; namespace[0] == 0 iff none
|
@param netns - optional tap netns; netns[0] == 0 if none
|
||||||
*/
|
*/
|
||||||
autoreply autoendian define lcp_itf_pair_add_del
|
autoreply autoendian define lcp_itf_pair_add_del
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@ autoreply autoendian define lcp_itf_pair_add_del
|
|||||||
vl_api_interface_index_t sw_if_index;
|
vl_api_interface_index_t sw_if_index;
|
||||||
string host_if_name[16]; /* IFNAMSIZ */
|
string host_if_name[16]; /* IFNAMSIZ */
|
||||||
vl_api_lcp_itf_host_type_t host_if_type;
|
vl_api_lcp_itf_host_type_t host_if_type;
|
||||||
string namespace[32]; /* LCP_NS_LEN */
|
string netns[32]; /* LCP_NS_LEN */
|
||||||
option in_progress;
|
option in_progress;
|
||||||
};
|
};
|
||||||
autoendian define lcp_itf_pair_add_del_v2
|
autoendian define lcp_itf_pair_add_del_v2
|
||||||
@@ -90,7 +90,7 @@ autoendian define lcp_itf_pair_add_del_v2
|
|||||||
vl_api_interface_index_t sw_if_index;
|
vl_api_interface_index_t sw_if_index;
|
||||||
string host_if_name[16]; /* IFNAMSIZ */
|
string host_if_name[16]; /* IFNAMSIZ */
|
||||||
vl_api_lcp_itf_host_type_t host_if_type;
|
vl_api_lcp_itf_host_type_t host_if_type;
|
||||||
string namespace[32]; /* LCP_NS_LEN */
|
string netns[32]; /* LCP_NS_LEN */
|
||||||
option in_progress;
|
option in_progress;
|
||||||
};
|
};
|
||||||
define lcp_itf_pair_add_del_v2_reply
|
define lcp_itf_pair_add_del_v2_reply
|
||||||
@@ -125,7 +125,7 @@ define lcp_itf_pair_get_reply
|
|||||||
@param vif_index - tap linux index
|
@param vif_index - tap linux index
|
||||||
@param host_if_name - host interface name
|
@param host_if_name - host interface name
|
||||||
@param host_if_type - host interface type (tun, tap)
|
@param host_if_type - host interface type (tun, tap)
|
||||||
@param namespace - host interface namespace
|
@param netns - host interface netns
|
||||||
*/
|
*/
|
||||||
autoendian define lcp_itf_pair_details
|
autoendian define lcp_itf_pair_details
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ autoendian define lcp_itf_pair_details
|
|||||||
u32 vif_index;
|
u32 vif_index;
|
||||||
string host_if_name[16]; /* IFNAMSIZ */
|
string host_if_name[16]; /* IFNAMSIZ */
|
||||||
vl_api_lcp_itf_host_type_t host_if_type;
|
vl_api_lcp_itf_host_type_t host_if_type;
|
||||||
string namespace[32]; /* LCP_NS_LEN */
|
string netns[32]; /* LCP_NS_LEN */
|
||||||
option in_progress;
|
option in_progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,9 @@ vl_api_lcp_itf_pair_add_del_t_handler (vl_api_lcp_itf_pair_add_del_t *mp)
|
|||||||
lip_host_type = api_decode_host_type (mp->host_if_type);
|
lip_host_type = api_decode_host_type (mp->host_if_type);
|
||||||
if (mp->is_add)
|
if (mp->is_add)
|
||||||
{
|
{
|
||||||
rv =
|
rv = vl_api_lcp_itf_pair_add (
|
||||||
vl_api_lcp_itf_pair_add (phy_sw_if_index, lip_host_type,
|
phy_sw_if_index, lip_host_type, mp->host_if_name,
|
||||||
mp->host_if_name, sizeof (mp->host_if_name),
|
sizeof (mp->host_if_name), mp->netns, sizeof (mp->netns), NULL);
|
||||||
mp->namespace, sizeof (mp->namespace), NULL);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -114,8 +113,8 @@ vl_api_lcp_itf_pair_add_del_v2_t_handler (vl_api_lcp_itf_pair_add_del_v2_t *mp)
|
|||||||
{
|
{
|
||||||
rv = vl_api_lcp_itf_pair_add (phy_sw_if_index, lip_host_type,
|
rv = vl_api_lcp_itf_pair_add (phy_sw_if_index, lip_host_type,
|
||||||
mp->host_if_name,
|
mp->host_if_name,
|
||||||
sizeof (mp->host_if_name), mp->namespace,
|
sizeof (mp->host_if_name), mp->netns,
|
||||||
sizeof (mp->namespace), &host_sw_if_index);
|
sizeof (mp->netns), &host_sw_if_index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -145,9 +144,9 @@ send_lcp_itf_pair_details (index_t lipi, vl_api_registration_t *rp,
|
|||||||
lcp_pair->lip_host_name, vec_len (lcp_pair->lip_host_name));
|
lcp_pair->lip_host_name, vec_len (lcp_pair->lip_host_name));
|
||||||
rmp->host_if_name[vec_len (lcp_pair->lip_host_name)] = 0;
|
rmp->host_if_name[vec_len (lcp_pair->lip_host_name)] = 0;
|
||||||
|
|
||||||
memcpy_s (rmp->namespace, sizeof (rmp->namespace),
|
memcpy_s (rmp->netns, sizeof (rmp->netns), lcp_pair->lip_namespace,
|
||||||
lcp_pair->lip_namespace, vec_len (lcp_pair->lip_namespace));
|
vec_len (lcp_pair->lip_namespace));
|
||||||
rmp->namespace[vec_len (lcp_pair->lip_namespace)] = 0;
|
rmp->netns[vec_len (lcp_pair->lip_namespace)] = 0;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +167,8 @@ vl_api_lcp_default_ns_set_t_handler (vl_api_lcp_default_ns_set_t *mp)
|
|||||||
vl_api_lcp_default_ns_set_reply_t *rmp;
|
vl_api_lcp_default_ns_set_reply_t *rmp;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
mp->namespace[LCP_NS_LEN - 1] = 0;
|
mp->netns[LCP_NS_LEN - 1] = 0;
|
||||||
rv = lcp_set_default_ns (mp->namespace);
|
rv = lcp_set_default_ns (mp->netns);
|
||||||
|
|
||||||
REPLY_MACRO (VL_API_LCP_DEFAULT_NS_SET_REPLY);
|
REPLY_MACRO (VL_API_LCP_DEFAULT_NS_SET_REPLY);
|
||||||
}
|
}
|
||||||
@@ -185,16 +184,12 @@ vl_api_lcp_default_ns_get_t_handler (vl_api_lcp_default_ns_get_t *mp)
|
|||||||
if (!reg)
|
if (!reg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rmp = vl_msg_api_alloc (sizeof (*rmp));
|
REPLY_MACRO_DETAILS2 (VL_API_LCP_DEFAULT_NS_GET_REPLY, ({
|
||||||
clib_memset (rmp, 0, sizeof (*rmp));
|
ns = (char *) lcp_get_default_ns ();
|
||||||
rmp->_vl_msg_id = (VL_API_LCP_DEFAULT_NS_GET_REPLY);
|
if (ns)
|
||||||
rmp->context = mp->context;
|
clib_strncpy ((char *) rmp->netns, ns,
|
||||||
|
LCP_NS_LEN - 1);
|
||||||
ns = (char *) lcp_get_default_ns ();
|
}));
|
||||||
if (ns)
|
|
||||||
clib_strncpy ((char *) rmp->namespace, ns, LCP_NS_LEN - 1);
|
|
||||||
|
|
||||||
vl_api_send_msg (reg, (u8 *) rmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user