From 13db969ba3ae84c8a18bf3d1c302bd9542faa27d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 17 Oct 2016 14:58:26 +0200 Subject: ipcpd: normal: Avoid allocating flow over unenrolled IPCP. There was no check to see if the normal IPCP was enrolled or not when a flow allocation request is done. --- src/ipcpd/normal/fmgr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 8c627641..cb25072e 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -389,6 +389,16 @@ int fmgr_np1_alloc(int fd, buffer_t buf; flow_alloc_msg_t msg = FLOW_ALLOC_MSG__INIT; + pthread_rwlock_rdlock(&ipcpi.state_lock); + + if (ipcp_get_state() != IPCP_ENROLLED) { + pthread_rwlock_unlock(&ipcpi.state_lock); + LOG_ERR("IPCP is not enrolled yet."); + return -1; /* -ENOTINIT */ + } + + pthread_rwlock_unlock(&ipcpi.state_lock); + /* FIXME: Obtain correct address here from DIF NSM */ msg.code = FLOW_ALLOC_CODE__FLOW_REQ; -- cgit v1.2.3