aboutsummaryrefslogtreecommitdiffstats
path: root/stacks
diff options
context:
space:
mode:
Diffstat (limited to 'stacks')
-rw-r--r--stacks/lwip_stack/CMakeLists.txt2
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_api_msg.c9
-rw-r--r--stacks/lwip_stack/lwip_src/common/stackx_spl_share.h12
-rw-r--r--stacks/lwip_stack/lwip_src/core/spl_timers.c1
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c6
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_prot_com.c28
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_prot_com.h3
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c19
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.c33
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.h1
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_tcp.c2
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_udp.c2
-rw-r--r--stacks/lwip_stack/src/alarm/alarm.c4
-rw-r--r--stacks/lwip_stack/src/maintain/fw_mt_config.c38
-rw-r--r--stacks/lwip_stack/src/sbr/sbr_protocol_api.h4
-rw-r--r--stacks/lwip_stack/src/sbr/sbr_res_mgr.h31
-rw-r--r--stacks/lwip_stack/src/sbr/sbr_socket.c43
-rw-r--r--stacks/vpp/adapt/dmm_vcl_adpt.c1
-rw-r--r--stacks/vpp/patch/0002-Fix-fix-epoll-problem.patch62
19 files changed, 249 insertions, 52 deletions
diff --git a/stacks/lwip_stack/CMakeLists.txt b/stacks/lwip_stack/CMakeLists.txt
index 0498824..297d2d9 100644
--- a/stacks/lwip_stack/CMakeLists.txt
+++ b/stacks/lwip_stack/CMakeLists.txt
@@ -67,7 +67,7 @@ execute_process(
COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/release/lwip_helper_files/download_lwip.sh
)
-ADD_DEFINITIONS(-D_GNU_SOURCE -DNSTACK_GETVER_VERSION="18.04")
+ADD_DEFINITIONS(-D_GNU_SOURCE -DNSTACK_GETVER_VERSION="18.07")
SET(JSON_C_SRC ${CMAKE_CURRENT_LIST_DIR}/../../thirdparty/json/json-c-0.12.1)
INCLUDE(ExternalProject)
diff --git a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
index 9ba1e92..0986ed4 100644
--- a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
+++ b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
@@ -3186,9 +3186,12 @@ update_tcp_state (spl_netconn_t * conn, enum tcp_state state)
spl_state = SPL_CLOSED;
break;
}
- conn->tcp_state = spl_state;
- NSTCP_LOGINF ("conn=%p,private_data=%p,state=%d", conn,
- conn->private_data, spl_state);
+ if (conn->tcp_state != spl_state)
+ {
+ conn->tcp_state = spl_state;
+ NSTCP_LOGINF ("conn=%p,private_data=%p,state=%d", conn,
+ conn->private_data, spl_state);
+ }
}
}
diff --git a/stacks/lwip_stack/lwip_src/common/stackx_spl_share.h b/stacks/lwip_stack/lwip_src/common/stackx_spl_share.h
index 3b0c9f9..2d35dd0 100644
--- a/stacks/lwip_stack/lwip_src/common/stackx_spl_share.h
+++ b/stacks/lwip_stack/lwip_src/common/stackx_spl_share.h
@@ -431,11 +431,23 @@ ss_set_is_listen_conn (spl_netconn_t * sh, i8 is_listen_conn)
}
static inline i32
+ss_inc_fork_ref (spl_netconn_t * sh)
+{
+ return __sync_add_and_fetch (&sh->recycle.fork_ref, 1);
+}
+
+static inline i32
ss_dec_fork_ref (spl_netconn_t * sh)
{
return __sync_sub_and_fetch (&sh->recycle.fork_ref, 1);
}
+static inline i32
+ss_get_fork_ref (spl_netconn_t * sh)
+{
+ return sh->recycle.fork_ref;
+}
+
static inline int
ss_add_pid (spl_netconn_t * sh, pid_t pid)
{
diff --git a/stacks/lwip_stack/lwip_src/core/spl_timers.c b/stacks/lwip_stack/lwip_src/core/spl_timers.c
index 50582fc..cfa130b 100644
--- a/stacks/lwip_stack/lwip_src/core/spl_timers.c
+++ b/stacks/lwip_stack/lwip_src/core/spl_timers.c
@@ -283,7 +283,6 @@ deal_timeout_sig (void)
int retval;
if (ptimer.first == NULL)
{
- NSPOL_LOGERR ("ptimer.first=NULL!!");
return;
}
tmo = rb_entry (ptimer.first, struct ptimer_node, node);
diff --git a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
index d5b228b..03b5998 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
@@ -823,13 +823,7 @@ read_fn (i32 fd)
return;
}
- const char *old_hbt_cnt = "6";
- const char *new_hbt_cnt = "60";
- nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM,
- (void *) new_hbt_cnt, sizeof (u16));
(void) read_configuration (); // if it returns -1, the err desc info will be wrote to g_config_data, so no need to check return value.
- nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM,
- (void *) old_hbt_cnt, sizeof (u16));
offset = 0;
left = MAX_IP_MODULE_BUFF_SIZE;
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.c b/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.c
index 6af2a77..292c17a 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.c
@@ -522,6 +522,34 @@ sbr_com_lock_common (sbr_socket_t * sk)
}
+void
+sbr_com_fork_parent (sbr_socket_t * sk, pid_t p)
+{
+ i32 ref = ss_inc_fork_ref (sbr_get_conn (sk));
+ NSSBR_LOGINF ("inc fork ref] fd=%d, p=%d, ref=%d, conn=%p, private_data=%p",
+ sk->fd, p, ref, sbr_get_conn (sk),
+ sbr_get_conn (sk)->private_data);
+}
+
+void
+sbr_com_fork_child (sbr_socket_t * sk, pid_t p, pid_t c)
+{
+ if (ss_add_pid (sbr_get_conn (sk), c) != 0)
+ {
+ NSSBR_LOGERR
+ ("add pid failed] fd=%d, p=%d, c=%d, ref=%d, conn=%p, private_data=%p",
+ sk->fd, p, c, ss_get_fork_ref (sbr_get_conn (sk)), sbr_get_conn (sk),
+ sbr_get_conn (sk)->private_data);
+ }
+ else
+ {
+ NSSBR_LOGINF
+ ("add pid ok] fd=%d, p=%d, c=%d, ref=%d, conn=%p, private_data=%p",
+ sk->fd, p, c, ss_get_fork_ref (sbr_get_conn (sk)), sbr_get_conn (sk),
+ sbr_get_conn (sk)->private_data);
+ }
+}
+
/*****************************************************************************
* Prototype : sbr_com_unlock_common
* Description : unlock common
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.h b/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.h
index 054393b..1be44cb 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.h
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_prot_com.h
@@ -150,6 +150,9 @@ int sbr_get_sockaddr_and_len (u16 port, spl_ip_addr_t * ip_addr,
struct sockaddr *addr, socklen_t * addrlen);
void sbr_com_set_app_info (sbr_socket_t * sk, void *appinfo);
+void sbr_com_fork_parent (sbr_socket_t * sk, pid_t p);
+void sbr_com_fork_child (sbr_socket_t * sk, pid_t p, pid_t c);
+
#ifdef __cplusplus
/* *INDENT-OFF* */
}
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c b/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c
index 94ef483..920d73d 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c
@@ -44,6 +44,25 @@ sbr_init_protocol ()
}
/*****************************************************************************
+* Prototype : sbr_fork_protocol
+* Description : init protocol
+* Input : None
+* Output : None
+* Return Value : int
+* Calls :
+* Called By :
+*
+*****************************************************************************/
+int
+sbr_fork_protocol ()
+{
+ pid_t pid = updata_sys_pid ();
+
+ NSSBR_LOGINF ("update pid in child]pid=%d", pid);
+ return sbr_fork_stackx ();
+}
+
+/*****************************************************************************
* Prototype : sbr_get_fdopt
* Description : get fdopt by domain type protocol
* Input : int domain
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.c b/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.c
index 331eee1..f3cb5b5 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.c
@@ -172,6 +172,39 @@ sbr_init_stackx ()
}
/*****************************************************************************
+* Prototype : sbr_fork_stackx
+* Description : init stackx res
+* Input : None
+* Output : None
+* Return Value : int
+* Calls :
+* Called By :
+*
+*****************************************************************************/
+int
+sbr_fork_stackx ()
+{
+
+ if (sbr_attach_group_array () != 0)
+ {
+ NSSBR_LOGERR ("sbr_attach_group_array failed");
+ return -1;
+ }
+
+ NSSBR_LOGDBG ("sbr_attach_group_array ok");
+
+ if (sbr_init_tx_pool () != 0)
+ {
+ NSSBR_LOGERR ("init tx pool failed");
+ return -1;
+ }
+
+ NSSBR_LOGDBG ("init tx pool ok");
+ NSSBR_LOGDBG ("sbr_fork_stackx ok");
+ return 0;
+}
+
+/*****************************************************************************
* Prototype : sbr_malloc_conn_for_sk
* Description : malloc netconn for sk,need add pid
* Input : sbr_socket_t* sk
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.h b/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.h
index e139644..73cec7f 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.h
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_res_mgr.h
@@ -56,6 +56,7 @@ sbr_get_spl_msg_box (sbr_socket_t * sk, u8 tos)
}
int sbr_init_stackx ();
+int sbr_fork_stackx ();
int sbr_malloc_conn_for_sk (sbr_socket_t * sk, spl_netconn_type_t type);
int sbr_init_conn_for_accept (sbr_socket_t * sk, spl_netconn_t * conn);
void sbr_free_conn_from_sk (sbr_socket_t * sk);
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c b/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
index c64dc7b..3225c2f 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
@@ -1690,6 +1690,8 @@ sbr_fdopt tcp_fdopt = {
.peak = sbr_com_peak,
.lock_common = sbr_com_lock_common,
.unlock_common = sbr_com_unlock_common,
+ .fork_parent = sbr_com_fork_parent,
+ .fork_child = sbr_com_fork_child,
.ep_getevt = stackx_eventpoll_getEvt,
.ep_ctl = stackx_eventpoll_triggle,
.set_close_stat = NULL,
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_udp.c b/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
index cf08731..69b822b 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
@@ -1163,6 +1163,8 @@ sbr_fdopt udp_fdopt = {
.peak = sbr_com_peak,
.lock_common = sbr_com_lock_common,
.unlock_common = sbr_com_unlock_common,
+ .fork_parent = sbr_com_fork_parent,
+ .fork_child = sbr_com_fork_child,
.ep_getevt = stackx_eventpoll_getEvt,
.ep_ctl = stackx_eventpoll_triggle,
.set_close_stat = NULL,
diff --git a/stacks/lwip_stack/src/alarm/alarm.c b/stacks/lwip_stack/src/alarm/alarm.c
index 5f89cdd..c158144 100644
--- a/stacks/lwip_stack/src/alarm/alarm.c
+++ b/stacks/lwip_stack/src/alarm/alarm.c
@@ -158,11 +158,9 @@ ns_alarm_module_init (void *param)
switch (proc_type)
{
case NSFW_PROC_MAIN:
-
- case NSFW_PROC_MASTER:
case NSFW_PROC_CTRL:
- /* [S138713][p00329905][20171219]modify ip address to vm id */
+ /* modify ip address to vm id */
pst_vm_id = getenv ("VM_ID");
if (INVALID_STR_LEN (pst_vm_id, MIN_VM_ID_LEN, MAX_VM_ID_LEN))
diff --git a/stacks/lwip_stack/src/maintain/fw_mt_config.c b/stacks/lwip_stack/src/maintain/fw_mt_config.c
index 400eaa0..403a46e 100644
--- a/stacks/lwip_stack/src/maintain/fw_mt_config.c
+++ b/stacks/lwip_stack/src/maintain/fw_mt_config.c
@@ -558,8 +558,7 @@ init_base_config (cfg_module_param * param)
{
/* initial default config */
/* omc_ctrl single log file should be 10M */
- if (param->proc_type == NSFW_PROC_MASTER
- || param->proc_type == NSFW_PROC_CTRL)
+ if (param->proc_type == NSFW_PROC_CTRL)
{
init_master_def_config_items ();
}
@@ -684,26 +683,6 @@ init_main_log_cfg_para ()
set_log_init_para (&log_para);
}
-NSTACK_STATIC void
-init_master_log_cfg_para ()
-{
- struct log_init_para log_para;
- log_para.mon_log_size = g_cfg_item_info[CFG_SEG_LOG][0].value;
- log_para.mon_log_count = g_cfg_item_info[CFG_SEG_LOG][1].value;
-
- /* log path valid check */
- if (0 == access (g_cfg_item_info[CFG_SEG_PATH][0].pvalue, W_OK))
- {
- log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].pvalue;
- }
- else
- {
- log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].default_str;
- }
-
- set_log_init_para (&log_para);
-}
-
/* nStackCtrl is the diff process with main, cannot use main process info,
need get the configure info respectively */
/* omc_ctrl single log file should be 10M */
@@ -739,17 +718,6 @@ init_module_cfg_nstackmain ()
init_main_log_cfg_para ();
}
-/*===========config init for nstack master=============*/
-
-NSTACK_STATIC void
-init_module_cfg_nstackmaster ()
-{
- /* init config data */
- init_module_cfg_default ();
-
- init_master_log_cfg_para ();
-}
-
/*===========config init for nstack ctrl=============*/
/* nStackCtrl is the diff process with main,
@@ -776,10 +744,6 @@ config_module_init (cfg_module_param * param)
init_module_cfg_nstackmain ();
break;
- case NSFW_PROC_MASTER:
- init_module_cfg_nstackmaster ();
- break;
-
case NSFW_PROC_CTRL:
init_module_cfg_nstackctrl ();
break;
diff --git a/stacks/lwip_stack/src/sbr/sbr_protocol_api.h b/stacks/lwip_stack/src/sbr/sbr_protocol_api.h
index 1c0fb1e..0eac1c4 100644
--- a/stacks/lwip_stack/src/sbr/sbr_protocol_api.h
+++ b/stacks/lwip_stack/src/sbr/sbr_protocol_api.h
@@ -70,6 +70,8 @@ typedef struct
int (*peak) (sbr_socket_t *);
void (*lock_common) (sbr_socket_t *);
void (*unlock_common) (sbr_socket_t *);
+ void (*fork_parent) (sbr_socket_t *, pid_t);
+ void (*fork_child) (sbr_socket_t *, pid_t, pid_t);
unsigned int (*ep_ctl) (sbr_socket_t *, int triggle_ops,
struct epoll_event * event, void *pdata);
unsigned int (*ep_getevt) (sbr_socket_t *, unsigned int events);
@@ -86,7 +88,7 @@ struct sbr_socket_s
};
int sbr_init_protocol ();
-
+int sbr_fork_protocol ();
sbr_fdopt *sbr_get_fdopt (int domain, int type, int protocol);
void sbr_app_touch_in (void); /*app send its version info to nStackMain */
diff --git a/stacks/lwip_stack/src/sbr/sbr_res_mgr.h b/stacks/lwip_stack/src/sbr/sbr_res_mgr.h
index 54729d4..e731314 100644
--- a/stacks/lwip_stack/src/sbr/sbr_res_mgr.h
+++ b/stacks/lwip_stack/src/sbr/sbr_res_mgr.h
@@ -117,6 +117,37 @@ sbr_lookup_sk (int fd)
return sk;
}
+/*****************************************************************************
+* Prototype : sbr_free_sk
+* Description : free sock
+* Input : sbr_socket_t * sk
+* Output : None
+* Return Value : static inline void
+* Calls :
+* Called By :
+*
+*****************************************************************************/
+static inline void
+sbr_free_fd (int fd)
+{
+ if ((fd < 1) || (fd > SBR_MAX_FD_NUM))
+ {
+ NSSBR_LOGERR ("fd is not ok]fd=%d", fd);
+ sbr_set_errno (EBADF);
+ return;
+ }
+
+ sbr_socket_t *sk = &g_res_group.sk[fd];
+ if (!sk->fdopt && !sk->sk_obj && !sk->stack_obj)
+ {
+ NSSBR_LOGERR
+ ("can't free empty fd] fd=%d, fdopt=%p, sk_obj=%p, stack_obj=%p", fd,
+ sk->fdopt, sk->sk_obj, sk->stack_obj);
+ return;
+ }
+ sbr_free_sk (sk);
+}
+
int sbr_init_res ();
#ifdef __cplusplus
diff --git a/stacks/lwip_stack/src/sbr/sbr_socket.c b/stacks/lwip_stack/src/sbr/sbr_socket.c
index 47aefda..e088224 100644
--- a/stacks/lwip_stack/src/sbr/sbr_socket.c
+++ b/stacks/lwip_stack/src/sbr/sbr_socket.c
@@ -1197,6 +1197,45 @@ SBR_INTERCEPT (int, fd_alloc, ())
return sbr_socket (AF_INET, SOCK_STREAM, 0);
}
+SBR_INTERCEPT (int, fork_init_child, (pid_t p, pid_t c))
+{
+ NSSBR_LOGDBG ("fork_init_child() is called]");
+ return sbr_fork_protocol ();
+}
+
+SBR_INTERCEPT (void, fork_parent_fd, (int s, pid_t p))
+{
+ NSSBR_LOGDBG ("fork_parent_fd() is called]");
+ sbr_socket_t *sk = sbr_lookup_sk (s);
+
+ if (!sk)
+ {
+ return;
+ }
+
+ sk->fdopt->fork_parent (sk, p);
+}
+
+SBR_INTERCEPT (void, fork_child_fd, (int s, pid_t p, pid_t c))
+{
+ NSSBR_LOGDBG ("fork_child_fd() is called]");
+ sbr_socket_t *sk = sbr_lookup_sk (s);
+
+ if (!sk)
+ {
+ return;
+ }
+
+ sk->fdopt->fork_child (sk, p, c);
+
+}
+
+SBR_INTERCEPT (void, fork_free_fd, (int s, pid_t p, pid_t c))
+{
+ NSSBR_LOGDBG ("fork_free_fd() is called]");
+ sbr_free_fd (s);
+}
+
/*****************************************************************************
* Prototype : nstack_stack_register
* Description : reg api to nsocket
@@ -1227,5 +1266,9 @@ nstack_stack_register (nstack_proc_cb * ops, nstack_event_cb * val)
(ops->extern_ops).ep_ctl = GET_SBR_INTERCEPT (ep_ctl);
(ops->extern_ops).peak = GET_SBR_INTERCEPT (peak);
(ops->extern_ops).stack_alloc_fd = GET_SBR_INTERCEPT (fd_alloc); /*alloc a fd id for epoll */
+ (ops->extern_ops).fork_init_child = GET_SBR_INTERCEPT (fork_init_child);
+ (ops->extern_ops).fork_parent_fd = GET_SBR_INTERCEPT (fork_parent_fd);
+ (ops->extern_ops).fork_child_fd = GET_SBR_INTERCEPT (fork_child_fd);
+ (ops->extern_ops).fork_free_fd = GET_SBR_INTERCEPT (fork_free_fd);
return 0;
}
diff --git a/stacks/vpp/adapt/dmm_vcl_adpt.c b/stacks/vpp/adapt/dmm_vcl_adpt.c
index 1b2b9a9..d4974e2 100644
--- a/stacks/vpp/adapt/dmm_vcl_adpt.c
+++ b/stacks/vpp/adapt/dmm_vcl_adpt.c
@@ -35,6 +35,7 @@ vpphs_ep_ctl_ops (int epFD, int proFD, int ctl_ops,
tmpEvt.data.ptr = pdata;
tmpEvt.events = events->events;
+ tmpEvt.events |= (EPOLLIN | EPOLLOUT);
if (DMM_VCL_ADPT_DEBUG > 0)
clib_warning ("DMM VCL ADPT<%d>: epfd=%d,fd=%d,ops=%d, events=%u",
diff --git a/stacks/vpp/patch/0002-Fix-fix-epoll-problem.patch b/stacks/vpp/patch/0002-Fix-fix-epoll-problem.patch
new file mode 100644
index 0000000..7975e27
--- /dev/null
+++ b/stacks/vpp/patch/0002-Fix-fix-epoll-problem.patch
@@ -0,0 +1,62 @@
+From bdb9568fe64c6bdfde17f61dac57a7f54214912c Mon Sep 17 00:00:00 2001
+From: Jiang Wenjiang <jiangwenjiang@huawei.com>
+Date: Mon, 10 Sep 2018 03:01:41 +0800
+Subject: [PATCH] Fix: fix epoll problem
+
+The same fd can add to different epoll.
+---
+ src/vcl/vppcom.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
+index cab2f60..9cb52cb 100644
+--- a/src/vcl/vppcom.c
++++ b/src/vcl/vppcom.c
+@@ -162,6 +162,7 @@ typedef struct
+ u64 options[16];
+ elog_track_t elog_track;
+ vce_event_handler_reg_t *poll_reg;
++ u32 ep_count; //the count that add to epoll
+ } session_t;
+
+ typedef struct vppcom_cfg_t_
+@@ -3430,6 +3431,7 @@ vppcom_session_write_ready (session_t * session, u32 session_index)
+
+ if (PREDICT_FALSE (session->state & STATE_LISTEN))
+ {
++ return 0;
+ clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx, sid %u: "
+ "cannot write to a listen session!",
+ getpid (), session->vpp_handle, session_index);
+@@ -3802,6 +3804,7 @@ vppcom_epoll_ctl (uint32_t vep_idx, int op, uint32_t session_index,
+ session_t *vep_session;
+ session_t *session;
+ int rv;
++ int ep_cnt = 0;
+
+ if (vep_idx == session_index)
+ {
+@@ -3846,6 +3849,9 @@ vppcom_epoll_ctl (uint32_t vep_idx, int op, uint32_t session_index,
+ switch (op)
+ {
+ case EPOLL_CTL_ADD:
++ ep_cnt = __sync_add_and_fetch (&(session->ep_count), 1);
++ if (ep_cnt != 1)
++ break;
+ if (PREDICT_FALSE (!event))
+ {
+ clib_warning ("VCL<%d>: ERROR: EPOLL_CTL_ADD: NULL pointer to "
+@@ -3950,6 +3956,10 @@ vppcom_epoll_ctl (uint32_t vep_idx, int op, uint32_t session_index,
+ break;
+
+ case EPOLL_CTL_DEL:
++ ep_cnt = __sync_sub_and_fetch (&(session->ep_count), 1);
++ if (ep_cnt != 0)
++ break;
++
+ if (PREDICT_FALSE (!session->is_vep_session))
+ {
+ clib_warning ("VCL<%d>: ERROR: sid %u EPOLL_CTL_DEL: "
+--
+1.8.3.1
+