summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2017-01-08 11:14:43 +0100
committerSander Vrijders <[email protected]>2017-01-09 11:23:48 +0100
commit0a071a42d4e80f54e92f34911cafda3d666d35d5 (patch)
tree456cb6250d0396705bef29b0d80c889bee205fe7 /src/ipcpd/normal/main.c
parente56d24010287127fc6b9c9da8d1f7cf160c50253 (diff)
downloadouroboros-0a071a42d4e80f54e92f34911cafda3d666d35d5.tar.gz
ouroboros-0a071a42d4e80f54e92f34911cafda3d666d35d5.zip
ipcpd: Let IPCPs bind a name
This allows IPCPs to bind a name, so that they can announce their name to neighbors which can then allocate a flow to them. Registering of the name happens by an administrator. It also moves the irmd_api to common ground, since it is used by all IPCPs.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 8db754aa..94f463af 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -26,6 +26,7 @@
#include <ouroboros/dev.h>
#include <ouroboros/ipcp-dev.h>
#include <ouroboros/time_utils.h>
+#include <ouroboros/irm.h>
#include "fmgr.h"
#include "ribmgr.h"
@@ -55,7 +56,7 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGINT:
case SIGTERM:
case SIGHUP:
- if (info->si_pid == irmd_api) {
+ if (info->si_pid == ipcpi.irmd_api) {
pthread_rwlock_wrlock(&ipcpi.state_lock);
if (ipcp_get_state() == IPCP_INIT)
@@ -195,12 +196,6 @@ static int normal_ipcp_enroll(char * dst_name)
pthread_rwlock_unlock(&ipcpi.state_lock);
- /* FIXME: Remove once we obtain neighbors during enrollment */
- if (fmgr_nm1_dt_flow(dst_name, QOS_CUBE_BE)) {
- LOG_ERR("Failed to establish data transfer flow.");
- return -1;
- }
-
LOG_DBG("Enrolled with %s.", dst_name);
return 0;
@@ -317,8 +312,11 @@ int main(int argc, char * argv[])
exit(EXIT_FAILURE);
}
- /* store the process id of the irmd */
- irmd_api = atoi(argv[1]);
+ if (irm_bind_api(getpid(), ipcpi.name)) {
+ LOG_ERR("Failed to bind AP name.");
+ close_logfile();
+ exit(EXIT_FAILURE);
+ }
/* init sig_act */
memset(&sig_act, 0, sizeof(sig_act));