vcl: support connected udp listens
Request connected udp listener behavior by setting
VPPCOM_ATTR_SET_CONNECTED attribute with vppcom_session_attr
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Iba95155c0f41cea8c6e1a4263946270d49c213ac
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 173b7fd..35e7804 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -209,6 +209,8 @@
clib_memcpy_fast (&mp->ip, &s->transport.lcl_ip, sizeof (mp->ip));
mp->port = s->transport.lcl_port;
mp->proto = s->session_type;
+ if (s->flags & VCL_SESSION_F_CONNECTED)
+ mp->flags = TRANSPORT_CFG_F_CONNECTED;
app_send_ctrl_evt_to_vpp (mq, app_evt);
}
@@ -3592,6 +3594,11 @@
*(int *) buffer = SHUT_RDWR;
*buflen = sizeof (int);
break;
+
+ case VPPCOM_ATTR_SET_CONNECTED:
+ session->flags |= VCL_SESSION_F_CONNECTED;
+ break;
+
default:
rv = VPPCOM_EINVAL;
break;
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index e2e0ae7..c61de37 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -160,6 +160,7 @@
VPPCOM_ATTR_SET_TCP_USER_MSS,
VPPCOM_ATTR_SET_SHUT,
VPPCOM_ATTR_GET_SHUT,
+ VPPCOM_ATTR_SET_CONNECTED,
} vppcom_attr_op_t;
typedef struct _vcl_poll
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index d0d6503..7a3eeeb 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -315,6 +315,7 @@
ip46_address_t ip;
u32 ckpair_index;
u8 crypto_engine;
+ u8 flags;
} __clib_packed session_listen_msg_t;
STATIC_ASSERT (sizeof (session_listen_msg_t) <= SESSION_CTRL_MSG_MAX_SIZE,
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index d2b918a..d49fa1e 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -60,6 +60,7 @@
a->sep_ext.crypto_engine = mp->crypto_engine;
a->app_index = app->app_index;
a->wrk_map_index = mp->wrk_index;
+ a->sep_ext.transport_flags = mp->flags;
if ((rv = vnet_listen (a)))
clib_warning ("listen returned: %d", rv);