summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-17 10:00:48 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-17 10:00:48 +0000
commitf5ca2eed99c8fa741e8d2e8385d1b4f10e433df8 (patch)
treec5e4af02e99a098dd123509cc67bfeb6efb6d69c
parent8cb5218438feaf455a297915d037675e3c3eea21 (diff)
parent645cf66af11ac36b81648f2e1eb3b1f5aeb7b544 (diff)
downloadouroboros-f5ca2eed99c8fa741e8d2e8385d1b4f10e433df8.tar.gz
ouroboros-f5ca2eed99c8fa741e8d2e8385d1b4f10e433df8.zip
Merged in dstaesse/ouroboros/be-ribmgr (pull request #378)0.4
ipcpd: Move RIB configuration to common header
-rw-r--r--include/ouroboros/config.h.in6
-rw-r--r--src/ipcpd/normal/dir.c3
-rw-r--r--src/ipcpd/normal/enroll.c8
-rw-r--r--src/ipcpd/normal/fmgr.c7
-rw-r--r--src/ipcpd/normal/gam.h1
-rw-r--r--src/ipcpd/normal/main.c6
-rw-r--r--src/ipcpd/normal/pol/complete.c1
-rw-r--r--src/ipcpd/normal/pol/flat.c1
-rw-r--r--src/ipcpd/normal/ribconfig.h39
-rw-r--r--src/ipcpd/normal/ribmgr.c12
-rw-r--r--src/ipcpd/normal/shm_pci.c5
-rw-r--r--src/lib/tests/rib_test.c2
12 files changed, 59 insertions, 32 deletions
diff --git a/include/ouroboros/config.h.in b/include/ouroboros/config.h.in
index 517eee45..7616961c 100644
--- a/include/ouroboros/config.h.in
+++ b/include/ouroboros/config.h.in
@@ -60,11 +60,5 @@
#define SOCKET_TIMEOUT 4000
#define CDAP_REPLY_TIMEOUT 1000
#define ENROLL_TIMEOUT 2000
-/* RIB configuration for normal */
-#define RIB_MAX_PATH_LEN 256
-#define BOOT_NAME "boot"
-#define MEMBERS_NAME "members"
-#define DIF_NAME "dif_name"
-#define DIR_NAME "directory"
#endif /* OUROBOROS_CONFIG */
diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c
index c67d303f..55d6e3f6 100644
--- a/src/ipcpd/normal/dir.c
+++ b/src/ipcpd/normal/dir.c
@@ -26,13 +26,12 @@
#include "dir.h"
#include "ipcp.h"
+#include "ribconfig.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#define DIR_PATH "/" DIR_NAME
-
static char dir_path[RIB_MAX_PATH_LEN + 1];
static void dir_path_reset(void) {
diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c
index a0d28598..bc5d2a20 100644
--- a/src/ipcpd/normal/enroll.c
+++ b/src/ipcpd/normal/enroll.c
@@ -29,6 +29,7 @@
#include <ouroboros/rib.h>
#include "ae.h"
+#include "ribconfig.h"
#include <assert.h>
#include <stdlib.h>
@@ -36,14 +37,9 @@
/* Symbolic, will return current time */
#define TIME_NAME "localtime"
+#define TIME_PATH DLR TIME_NAME
#define ENROLL_WARN_TIME_OFFSET 20
-#define DLR "/"
-#define DIF_PATH DLR DIF_NAME
-#define BOOT_PATH DLR BOOT_NAME
-#define MEMBERS_PATH DLR MEMBERS_NAME
-#define TIME_PATH DLR TIME_NAME
-
int enroll_handle(int fd)
{
struct cdap * ci;
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index 31c83ac5..c2b53abf 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -36,6 +36,7 @@
#include "ipcp.h"
#include "shm_pci.h"
#include "gam.h"
+#include "ribconfig.h"
#include <stdlib.h>
#include <stdbool.h>
@@ -285,13 +286,13 @@ int fmgr_init(void)
}
}
- if (rib_read("/" BOOT_NAME "/dt/gam/type", &pg, sizeof(pg))
+ if (rib_read(BOOT_PATH "/dt/gam/type", &pg, sizeof(pg))
!= sizeof(pg)) {
log_err("Failed to read policy for ribmgr gam.");
return -1;
}
- if (rib_read("/" BOOT_NAME "/dt/gam/cacep", &pc, sizeof(pc))
+ if (rib_read(BOOT_PATH "/dt/gam/cacep", &pc, sizeof(pc))
!= sizeof(pc)) {
log_err("Failed to read CACEP policy for ribmgr gam.");
return -1;
@@ -375,7 +376,7 @@ int fmgr_np1_alloc(int fd,
assert(strlen(dst_ap_name) + strlen("/" DIR_NAME) + 1
< RIB_MAX_PATH_LEN);
- strcpy(path, "/" DIR_NAME);
+ strcpy(path, DIR_PATH);
rib_path_append(path, dst_ap_name);
diff --git a/src/ipcpd/normal/gam.h b/src/ipcpd/normal/gam.h
index e858114c..50f83df9 100644
--- a/src/ipcpd/normal/gam.h
+++ b/src/ipcpd/normal/gam.h
@@ -24,6 +24,7 @@
#define OUROBOROS_IPCPD_NORMAL_GAM_H
#include <ouroboros/cacep.h>
+#include <ouroboros/irm_config.h>
struct gam * gam_create(enum pol_gam gam_type,
const char * ae_name);
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 11ec0938..e3955ff2 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -39,6 +39,7 @@
#include "fmgr.h"
#include "frct.h"
#include "ipcp.h"
+#include "ribconfig.h"
#include "ribmgr.h"
#include <stdbool.h>
@@ -49,11 +50,6 @@
#include <assert.h>
#include <inttypes.h>
-#define DLR "/"
-#define DIF_PATH DLR DIF_NAME
-#define BOOT_PATH DLR BOOT_NAME
-#define MEMBERS_PATH DLR MEMBERS_NAME
-
#define THIS_TYPE IPCP_NORMAL
struct {
diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c
index f85fd749..5faa1ae8 100644
--- a/src/ipcpd/normal/pol/complete.c
+++ b/src/ipcpd/normal/pol/complete.c
@@ -30,6 +30,7 @@
#include "ipcp.h"
#include "gam.h"
+#include "ribconfig.h"
#include <string.h>
#include <stdlib.h>
diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c
index 61b0110c..d982f5ac 100644
--- a/src/ipcpd/normal/pol/flat.c
+++ b/src/ipcpd/normal/pol/flat.c
@@ -30,6 +30,7 @@
#include <ouroboros/utils.h>
#include "ipcp.h"
+#include "ribconfig.h"
#include <time.h>
#include <stdlib.h>
diff --git a/src/ipcpd/normal/ribconfig.h b/src/ipcpd/normal/ribconfig.h
new file mode 100644
index 00000000..15b65ce2
--- /dev/null
+++ b/src/ipcpd/normal/ribconfig.h
@@ -0,0 +1,39 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2017
+ *
+ * Normal IPC Process - RIB configuration
+ *
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H
+#define OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H
+
+/* RIB configuration for normal */
+#define RIB_MAX_PATH_LEN 256
+
+#define DLR "/"
+#define BOOT_NAME "boot"
+#define MEMBERS_NAME "members"
+#define DIF_NAME "dif_name"
+#define DIR_NAME "directory"
+#define DIF_PATH DLR DIF_NAME
+#define DIR_PATH DLR DIR_NAME
+#define BOOT_PATH DLR BOOT_NAME
+#define MEMBERS_PATH DLR MEMBERS_NAME
+
+#endif /* OUROBOROS_IPCPD_NORMAL_RIB_CONFIG_H */
diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c
index 05d881ea..f254bd50 100644
--- a/src/ipcpd/normal/ribmgr.c
+++ b/src/ipcpd/normal/ribmgr.c
@@ -3,7 +3,8 @@
*
* RIB manager of the IPC Process
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -32,11 +33,10 @@
#include <ouroboros/fqueue.h>
#include <ouroboros/rib.h>
-#include "timerwheel.h"
-#include "addr_auth.h"
-#include "ribmgr.h"
-#include "gam.h"
#include "ae.h"
+#include "gam.h"
+#include "ribconfig.h"
+#include "ribmgr.h"
#include <stdlib.h>
#include <pthread.h>
@@ -44,8 +44,6 @@
#include <errno.h>
#include <assert.h>
-#define BOOT_PATH "/" BOOT_NAME
-
struct {
flow_set_t * fs;
fqueue_t * fq;
diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c
index 1c2cee54..0807a24f 100644
--- a/src/ipcpd/normal/shm_pci.c
+++ b/src/ipcpd/normal/shm_pci.c
@@ -25,8 +25,9 @@
#include <ouroboros/crc32.h>
#include <ouroboros/rib.h>
-#include "shm_pci.h"
#include "dt_const.h"
+#include "shm_pci.h"
+#include "ribconfig.h"
#include <stdlib.h>
#include <string.h>
@@ -38,8 +39,6 @@
#define TTL_SIZE 1
#define CHK_SIZE 4
-#define BOOT_PATH "/" BOOT_NAME
-
struct {
struct dt_const dtc;
size_t head_size;
diff --git a/src/lib/tests/rib_test.c b/src/lib/tests/rib_test.c
index a7ae7311..8996c379 100644
--- a/src/lib/tests/rib_test.c
+++ b/src/lib/tests/rib_test.c
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <string.h>
+#define RIB_MAX_PATH_LEN 256
+
int rib_test(int argc,
char ** argv)
{