aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-01-28 11:39:27 -0800
committerFlorin Coras <fcoras@cisco.com>2021-01-28 11:39:57 -0800
commit6a6555ac34cf1c74cb3d82ae3b77232797c73b6a (patch)
treeb08e21864bb7bc6041ee4d948435e9367e73b286 /src
parent096a1d599c494ad03575528a1b2d8ec139407fce (diff)
vcl: support set/get vrf attribute
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I011faa52939d44bdc90de69ad381dc1eea8c8eb3
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vcl_private.h1
-rw-r--r--src/vcl/vppcom.c21
-rw-r--r--src/vcl/vppcom.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index e4e73e0430d..21853ebdc9a 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -161,6 +161,7 @@ typedef struct vcl_session_
u32 attributes; /**< see @ref vppcom_session_attr_t */
int libc_epfd;
u32 ckpair_index;
+ u32 vrf;
u32 sndbuf_size; // VPP-TBD: Hack until support setsockopt(SO_SNDBUF)
u32 rcvbuf_size; // VPP-TBD: Hack until support setsockopt(SO_RCVBUF)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 184cb821e1d..cf8bb72d451 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -183,6 +183,7 @@ vcl_send_session_listen (vcl_worker_t * wrk, vcl_session_t * s)
mp->port = s->transport.lcl_port;
mp->proto = s->session_type;
mp->ckpair_index = s->ckpair_index;
+ mp->vrf = s->vrf;
if (s->flags & VCL_SESSION_F_CONNECTED)
mp->flags = TRANSPORT_CFG_F_CONNECTED;
app_send_ctrl_evt_to_vpp (mq, app_evt);
@@ -210,6 +211,7 @@ vcl_send_session_connect (vcl_worker_t * wrk, vcl_session_t * s)
mp->lcl_port = s->transport.lcl_port;
mp->proto = s->session_type;
mp->ckpair_index = s->ckpair_index;
+ mp->vrf = s->vrf;
if (s->flags & VCL_SESSION_F_CONNECTED)
mp->flags |= TRANSPORT_CFG_F_CONNECTED;
app_send_ctrl_evt_to_vpp (mq, app_evt);
@@ -3673,6 +3675,25 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
session->ckpair_index = *(uint32_t *) buffer;
break;
+ case VPPCOM_ATTR_SET_VRF:
+ if (!(buffer && buflen && (*buflen == sizeof (u32))))
+ {
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+ session->vrf = *(u32 *) buffer;
+ break;
+
+ case VPPCOM_ATTR_GET_VRF:
+ if (!(buffer && buflen && (*buflen >= sizeof (u32))))
+ {
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+ *(u32 *) buffer = session->vrf;
+ *buflen = sizeof (u32);
+ break;
+
default:
rv = VPPCOM_EINVAL;
break;
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index 77be8061159..6e3c2784db6 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -138,6 +138,8 @@ typedef enum
VPPCOM_ATTR_GET_SHUT,
VPPCOM_ATTR_SET_CONNECTED,
VPPCOM_ATTR_SET_CKPAIR,
+ VPPCOM_ATTR_SET_VRF,
+ VPPCOM_ATTR_GET_VRF,
} vppcom_attr_op_t;
typedef struct _vcl_poll