summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/fmgr.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-17 13:29:20 +0000
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-17 13:29:20 +0000
commit680017a72c7a15b90f223bafcea80fd3e264e984 (patch)
tree20f6c9e291ffc71882e72f40f7be3a56b3c412ca /src/ipcpd/normal/fmgr.c
parentafb04d957a5322d483e6422f3baf1a651915af10 (diff)
parent13db969ba3ae84c8a18bf3d1c302bd9542faa27d (diff)
downloadouroboros-680017a72c7a15b90f223bafcea80fd3e264e984.tar.gz
ouroboros-680017a72c7a15b90f223bafcea80fd3e264e984.zip
Merged in sandervrijders/ouroboros/be-fix-normal (pull request #266)
ipcpd: normal: Avoid allocating flow over unenrolled IPCP.
Diffstat (limited to 'src/ipcpd/normal/fmgr.c')
-rw-r--r--src/ipcpd/normal/fmgr.c10
1 files changed, 10 insertions, 0 deletions
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;