summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-05-15 10:11:25 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-05-15 10:11:25 +0000
commit0fc0f3701ef4f504e71eadcc92a93faf1dd33bf4 (patch)
treeea16469c2d8fbcb417ed89e0bbd550834d0602a6
parentb36acfd93b1dc16a153ca9b9077d113732accb4e (diff)
parent9903b8a2f9a7dc8ebac6928dcf2d2b5593ea0615 (diff)
downloadouroboros-0fc0f3701ef4f504e71eadcc92a93faf1dd33bf4.tar.gz
ouroboros-0fc0f3701ef4f504e71eadcc92a93faf1dd33bf4.zip
Merged in dstaesse/ouroboros/be-syntax-dev (pull request #505)
ipcpd: Allow specifying fixed syntax
-rw-r--r--include/ouroboros/CMakeLists.txt1
-rw-r--r--include/ouroboros/cacep.h12
-rw-r--r--include/ouroboros/ipcp.h30
-rw-r--r--include/ouroboros/proto.h44
-rw-r--r--include/ouroboros/sockets.h1
-rw-r--r--src/ipcpd/ipcp.c45
-rw-r--r--src/ipcpd/local/main.c2
-rw-r--r--src/ipcpd/normal/dt.h6
-rw-r--r--src/ipcpd/normal/dt_pci.c70
-rw-r--r--src/ipcpd/normal/dt_pci.h23
-rw-r--r--src/ipcpd/normal/main.c34
-rw-r--r--src/ipcpd/shim-eth-llc/main.c2
-rw-r--r--src/ipcpd/shim-udp/main.c2
-rw-r--r--src/irmd/ipcp.c6
-rw-r--r--src/irmd/main.c8
-rw-r--r--src/lib/cacep.proto20
-rw-r--r--src/lib/ipcp_config.proto35
-rw-r--r--src/lib/ipcpd_messages.proto23
-rw-r--r--src/lib/irm.c47
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c137
20 files changed, 263 insertions, 285 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index f582b915..8f57d4d7 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -13,6 +13,7 @@ set(HEADER_FILES
ipcp.h
irm.h
nsm.h
+ proto.h
qos.h)
install(FILES ${HEADER_FILES} DESTINATION usr/include/ouroboros)
diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h
index 967151de..fb52fd0f 100644
--- a/include/ouroboros/cacep.h
+++ b/include/ouroboros/cacep.h
@@ -25,21 +25,19 @@
#define OUROBOROS_CACEP_H
#include <ouroboros/cdefs.h>
+#include <ouroboros/proto.h>
#include <stdint.h>
-
-enum proto_concrete_syntax {
- PROTO_GPB = 0,
- PROTO_ASN_1,
- PROTO_FIXED
-};
+#include <sys/types.h>
struct conn_info {
char ae_name[64];
char protocol[64];
uint32_t pref_version;
enum proto_concrete_syntax pref_syntax;
- uint64_t addr;
+ struct proto_field fixed_conc_syntax[PROTO_MAX_FIELDS];
+ size_t num_fields;
+ uint64_t addr; /* AE-I name */
};
__BEGIN_DECLS
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index f418d640..05fdcd49 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -57,22 +57,22 @@ enum hash_algo {
HASH_SHA3_512
};
+#define DIF_NAME_SIZE 256
+
+struct dif_info {
+ char dif_name[DIF_NAME_SIZE];
+ enum hash_algo dir_hash_algo;
+};
+
struct ipcp_config {
- char * dif_name;
+ struct dif_info dif_info;
+
enum ipcp_type type;
- enum hash_algo dir_hash_algo;
- /* Normal DIF */
+ /* DT syntax */
uint8_t addr_size;
- uint8_t cep_id_size;
- uint8_t pdu_length_size;
- uint8_t seqno_size;
-
+ uint8_t fd_size;
bool has_ttl;
- bool has_chk;
-
- uint32_t min_pdu_size;
- uint32_t max_pdu_size;
enum pol_addr_auth addr_auth_type;
enum pol_gam dt_gam_type;
@@ -86,12 +86,4 @@ struct ipcp_config {
char * if_name;
};
-#define DIF_NAME_SIZE 256
-
-/* capability report of a DIF */
-struct dif_info {
- enum hash_algo algo;
- char dif_name[DIF_NAME_SIZE];
-};
-
#endif /* OUROBOROS_IPCP_H */
diff --git a/include/ouroboros/proto.h b/include/ouroboros/proto.h
new file mode 100644
index 00000000..30c549c0
--- /dev/null
+++ b/include/ouroboros/proto.h
@@ -0,0 +1,44 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2017
+ *
+ * Protocol syntax definitions
+ *
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef OUROBOROS_PROTO_H
+#define OUROBOROS_PROTO_H
+
+#include <sys/types.h>
+
+#define PROTO_FIELD_ABSENT -1
+#define PROTO_FIELD_VARIABLE 0
+#define PROTO_MAX_FIELDS 128
+
+enum proto_concrete_syntax {
+ PROTO_GPB = 0,
+ PROTO_ASN_1,
+ PROTO_FIXED
+};
+
+struct proto_field {
+ size_t fid; /* an ID for the protocol field */
+ ssize_t len; /* 0 variable, -1 not present */
+};
+
+#endif /* OUROBOROS_PROTO_H */
diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h
index bb8f6d87..660709bf 100644
--- a/include/ouroboros/sockets.h
+++ b/include/ouroboros/sockets.h
@@ -28,6 +28,7 @@
#include "ipcp_config.pb-c.h"
typedef IpcpConfigMsg ipcp_config_msg_t;
+typedef DifInfoMsg dif_info_msg_t;
#include "irmd_messages.pb-c.h"
typedef IrmMsg irm_msg_t;
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 7f3ebc73..4737b1cd 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -133,22 +133,21 @@ static void thread_exit(ssize_t id)
static void * ipcp_main_loop(void * o)
{
- int lsockfd;
- uint8_t buf[IPCP_MSG_BUF_SIZE];
-
- ipcp_msg_t * msg;
- ssize_t count;
- buffer_t buffer;
- ipcp_msg_t ret_msg = IPCP_MSG__INIT;
-
- ipcp_config_msg_t * conf_msg;
+ int lsockfd;
+ uint8_t buf[IPCP_MSG_BUF_SIZE];
+ ssize_t count;
+ buffer_t buffer;
struct ipcp_config conf;
struct dif_info info;
- struct timeval ltv = {(SOCKET_TIMEOUT / 1000),
- (SOCKET_TIMEOUT % 1000) * 1000};
+ ipcp_config_msg_t * conf_msg;
+ ipcp_msg_t * msg;
+ ipcp_msg_t ret_msg = IPCP_MSG__INIT;
+ dif_info_msg_t dif_info = DIF_INFO_MSG__INIT;
+ struct timeval ltv = {(SOCKET_TIMEOUT / 1000),
+ (SOCKET_TIMEOUT % 1000) * 1000};
- ssize_t id = (ssize_t) o;
+ ssize_t id = (ssize_t) o;
while (true) {
#ifdef __FreeBSD__
@@ -213,23 +212,19 @@ static void * ipcp_main_loop(void * o)
conf_msg = msg->conf;
conf.type = conf_msg->ipcp_type;
- conf.dir_hash_algo = conf_msg->dir_hash_algo;
- conf.dif_name = conf_msg->dif_name;
- if (conf.dif_name == NULL) {
+ conf.dif_info.dir_hash_algo =
+ conf_msg->dif_info->dir_hash_algo;
+ strcpy(conf.dif_info.dif_name,
+ conf_msg->dif_info->dif_name);
+ if (conf.dif_info.dif_name == NULL) {
ret_msg.has_result = true;
ret_msg.result = -1;
break;
}
if (conf_msg->ipcp_type == IPCP_NORMAL) {
conf.addr_size = conf_msg->addr_size;
- conf.cep_id_size = conf_msg->cep_id_size;
- conf.pdu_length_size =
- conf_msg->pdu_length_size;
- conf.seqno_size = conf_msg->seqno_size;
+ conf.fd_size = conf_msg->fd_size;
conf.has_ttl = conf_msg->has_ttl;
- conf.has_chk = conf_msg->has_chk;
- conf.min_pdu_size = conf_msg->min_pdu_size;
- conf.max_pdu_size = conf_msg->max_pdu_size;
conf.addr_auth_type = conf_msg->addr_auth_type;
conf.dt_gam_type = conf_msg->dt_gam_type;
conf.rm_gam_type = conf_msg->rm_gam_type;
@@ -264,9 +259,9 @@ static void * ipcp_main_loop(void * o)
&info);
if (ret_msg.result == 0) {
- ret_msg.has_dir_hash_algo = true;
- ret_msg.dir_hash_algo = info.algo;
- ret_msg.dif_name = info.dif_name;
+ ret_msg.dif_info = &dif_info;
+ dif_info.dir_hash_algo = info.dir_hash_algo;
+ dif_info.dif_name = info.dif_name;
}
break;
case IPCP_MSG_CODE__IPCP_REG:
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 162ce4d9..6d89045c 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -119,7 +119,7 @@ static int ipcp_local_bootstrap(const struct ipcp_config * conf)
assert(conf);
assert(conf->type == THIS_TYPE);
- ipcpi.dir_hash_algo = conf->dir_hash_algo;
+ ipcpi.dir_hash_algo = conf->dif_info.dir_hash_algo;
ipcp_set_state(IPCP_OPERATIONAL);
diff --git a/src/ipcpd/normal/dt.h b/src/ipcpd/normal/dt.h
index b7b3f7c6..52760154 100644
--- a/src/ipcpd/normal/dt.h
+++ b/src/ipcpd/normal/dt.h
@@ -29,12 +29,6 @@
#define INVALID_ADDR 0
-#define DT_PROTO "dt"
-#define FD_FA 1
-#define FD_DHT 2
-
-typedef uint32_t dt_cep_id_t;
-
int dt_init(void);
void dt_fini(void);
diff --git a/src/ipcpd/normal/dt_pci.c b/src/ipcpd/normal/dt_pci.c
index 9f3b9a91..a4f99142 100644
--- a/src/ipcpd/normal/dt_pci.c
+++ b/src/ipcpd/normal/dt_pci.c
@@ -25,7 +25,6 @@
#include <ouroboros/crc32.h>
#include <ouroboros/rib.h>
-#include "dt_const.h"
#include "dt_pci.h"
#include "ribconfig.h"
@@ -33,16 +32,13 @@
#include <string.h>
#include <assert.h>
-#define PDU_TYPE_SIZE 1
-#define QC_SIZE 1
#define DEFAULT_TTL 60
-#define TTL_SIZE 1
-#define CHK_SIZE 4
struct {
- struct dt_const dtc;
+ uint8_t addr_size;
+ uint8_t fd_size;
+ bool has_ttl;
size_t head_size;
- size_t tail_size;
/* offsets */
size_t qc_o;
@@ -50,29 +46,28 @@ struct {
size_t fd_o;
} dt_pci_info;
-int dt_pci_init(void)
+int dt_pci_init()
{
/* read dt constants from the RIB */
if (rib_read(BOOT_PATH "/dt/const/addr_size",
- &dt_pci_info.dtc.addr_size,
- sizeof(dt_pci_info.dtc.addr_size)) < 0 ||
+ &dt_pci_info.addr_size,
+ sizeof(dt_pci_info.addr_size)) < 0 ||
+ rib_read(BOOT_PATH "/dt/const/fd_size",
+ &dt_pci_info.fd_size,
+ sizeof(dt_pci_info.fd_size)) < 0 ||
rib_read(BOOT_PATH "/dt/const/has_ttl",
- &dt_pci_info.dtc.has_ttl,
- sizeof(dt_pci_info.dtc.has_ttl)) < 0 ||
- rib_read(BOOT_PATH "/dt/const/has_chk",
- &dt_pci_info.dtc.has_chk,
- sizeof(dt_pci_info.dtc.has_chk)) < 0)
+ &dt_pci_info.has_ttl,
+ sizeof(dt_pci_info.has_ttl)) < 0)
return -1;
- dt_pci_info.qc_o = dt_pci_info.dtc.addr_size;
- dt_pci_info.ttl_o = dt_pci_info.qc_o + QC_SIZE;
- if (dt_pci_info.dtc.has_ttl)
- dt_pci_info.fd_o = dt_pci_info.ttl_o + TTL_SIZE;
+ dt_pci_info.qc_o = dt_pci_info.addr_size;
+ dt_pci_info.ttl_o = dt_pci_info.qc_o + QOS_LEN;
+ if (dt_pci_info.has_ttl)
+ dt_pci_info.fd_o = dt_pci_info.ttl_o + TTL_LEN;
else
dt_pci_info.fd_o = dt_pci_info.ttl_o;
- dt_pci_info.head_size = dt_pci_info.fd_o + PDU_TYPE_SIZE;
- dt_pci_info.tail_size = dt_pci_info.dtc.has_chk ? CHK_SIZE : 0;
+ dt_pci_info.head_size = dt_pci_info.fd_o + dt_pci_info.fd_size;
return 0;
}
@@ -85,7 +80,6 @@ int dt_pci_ser(struct shm_du_buff * sdb,
struct dt_pci * dt_pci)
{
uint8_t * head;
- uint8_t * tail;
uint8_t ttl = DEFAULT_TTL;
assert(sdb);
@@ -96,22 +90,11 @@ int dt_pci_ser(struct shm_du_buff * sdb,
return -EPERM;
/* FIXME: Add check and operations for Big Endian machines */
- memcpy(head, &dt_pci->dst_addr, dt_pci_info.dtc.addr_size);
- memcpy(head + dt_pci_info.qc_o, &dt_pci->qc, QC_SIZE);
- if (dt_pci_info.dtc.has_ttl)
- memcpy(head + dt_pci_info.ttl_o, &ttl, TTL_SIZE);
- memcpy(head + dt_pci_info.fd_o, &dt_pci->fd, PDU_TYPE_SIZE);
-
- if (dt_pci_info.dtc.has_chk) {
- tail = shm_du_buff_tail_alloc(sdb, dt_pci_info.tail_size);
- if (tail == NULL) {
- shm_du_buff_head_release(sdb, dt_pci_info.head_size);
- return -EPERM;
- }
-
- *((uint32_t *) tail) = 0;
- crc32((uint32_t *) tail, head, tail - head);
- }
+ memcpy(head, &dt_pci->dst_addr, dt_pci_info.addr_size);
+ memcpy(head + dt_pci_info.qc_o, &dt_pci->qc, QOS_LEN);
+ if (dt_pci_info.has_ttl)
+ memcpy(head + dt_pci_info.ttl_o, &ttl, TTL_LEN);
+ memcpy(head + dt_pci_info.fd_o, &dt_pci->fd, dt_pci_info.fd_size);
return 0;
}
@@ -127,17 +110,17 @@ void dt_pci_des(struct shm_du_buff * sdb,
head = shm_du_buff_head(sdb);
/* FIXME: Add check and operations for Big Endian machines */
- memcpy(&dt_pci->dst_addr, head, dt_pci_info.dtc.addr_size);
- memcpy(&dt_pci->qc, head + dt_pci_info.qc_o, QC_SIZE);
+ memcpy(&dt_pci->dst_addr, head, dt_pci_info.addr_size);
+ memcpy(&dt_pci->qc, head + dt_pci_info.qc_o, QOS_LEN);
- if (dt_pci_info.dtc.has_ttl) {
+ if (dt_pci_info.has_ttl) {
--*(head + dt_pci_info.ttl_o); /* decrease TTL */
- memcpy(&dt_pci->ttl, head + dt_pci_info.ttl_o, TTL_SIZE);
+ memcpy(&dt_pci->ttl, head + dt_pci_info.ttl_o, TTL_LEN);
} else {
dt_pci->ttl = 1;
}
- memcpy(&dt_pci->fd, head + dt_pci_info.fd_o, PDU_TYPE_SIZE);
+ memcpy(&dt_pci->fd, head + dt_pci_info.fd_o, dt_pci_info.fd_size);
}
void dt_pci_shrink(struct shm_du_buff * sdb)
@@ -145,5 +128,4 @@ void dt_pci_shrink(struct shm_du_buff * sdb)
assert(sdb);
shm_du_buff_head_release(sdb, dt_pci_info.head_size);
- shm_du_buff_tail_release(sdb, dt_pci_info.tail_size);
}
diff --git a/src/ipcpd/normal/dt_pci.h b/src/ipcpd/normal/dt_pci.h
index 280956f4..13f782a4 100644
--- a/src/ipcpd/normal/dt_pci.h
+++ b/src/ipcpd/normal/dt_pci.h
@@ -24,8 +24,31 @@
#define OUROBOROS_IPCPD_NORMAL_DT_PCI_H
#include <ouroboros/shm_du_buff.h>
+#include <ouroboros/proto.h>
#include <ouroboros/shared.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#define DT_PROTO "dt"
+#define FD_FA 1
+#define FD_DHT 2
+
+/* Abstract syntax */
+enum dtp_fields {
+ DTP_DST = 0, /* DST ADDRESS */
+ DTP_QOS, /* QOS ID */
+ DTP_DFD, /* DEST FD */
+ DTP_TTL, /* TTL FIELD */
+ DTP_NUM_FIELDS /* number of fields */
+};
+
+/* Default field lengths */
+#define TTL_LEN 1
+#define QOS_LEN 1
+#define DFD_LEN 1
+#define DST_LEN 2
+
struct dt_pci {
uint64_t dst_addr;
qoscube_t qc;
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index d103b339..f9718041 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -229,7 +229,7 @@ static int normal_ipcp_enroll(const char * dst,
log_dbg("Enrolled with " HASH_FMT, HASH_VAL(dst));
- info->algo = ipcpi.dir_hash_algo;
+ info->dir_hash_algo = ipcpi.dir_hash_algo;
strcpy(info->dif_name, ipcpi.dif_name);
@@ -259,12 +259,8 @@ const struct ros {
{BOOT_PATH "/dt/gam", "cacep"},
{BOOT_PATH "/dt", "const"},
{BOOT_PATH "/dt/const", "addr_size"},
- {BOOT_PATH "/dt/const", "cep_id_size"},
- {BOOT_PATH "/dt/const", "seqno_size"},
+ {BOOT_PATH "/dt/const", "fd_size"},
{BOOT_PATH "/dt/const", "has_ttl"},
- {BOOT_PATH "/dt/const", "has_chk"},
- {BOOT_PATH "/dt/const", "min_pdu_size"},
- {BOOT_PATH "/dt/const", "max_pdu_size"},
/* RIB MGR COMPONENT */
{BOOT_PATH, "rm"},
@@ -301,7 +297,7 @@ static int normal_ipcp_bootstrap(const struct ipcp_config * conf)
assert(conf);
assert(conf->type == THIS_TYPE);
- hash_algo = hton32((uint32_t) conf->dir_hash_algo);
+ hash_algo = hton32((uint32_t) conf->dif_info.dir_hash_algo);
assert(ntoh32(hash_algo) != 0);
@@ -311,32 +307,20 @@ static int normal_ipcp_bootstrap(const struct ipcp_config * conf)
}
if (rib_write(BOOT_PATH "/general/dif_name",
- conf->dif_name,
- strlen(conf->dif_name) + 1) ||
+ conf->dif_info.dif_name,
+ strlen(conf->dif_info.dif_name) + 1) ||
rib_write(BOOT_PATH "/general/dir_hash_algo",
&hash_algo,
sizeof(hash_algo)) ||
rib_write(BOOT_PATH "/dt/const/addr_size",
&conf->addr_size,
sizeof(conf->addr_size)) ||
- rib_write(BOOT_PATH "/dt/const/cep_id_size",
- &conf->cep_id_size,
- sizeof(conf->cep_id_size)) ||
- rib_write(BOOT_PATH "/dt/const/seqno_size",
- &conf->seqno_size,
- sizeof(conf->seqno_size)) ||
+ rib_write(BOOT_PATH "/dt/const/fd_size",
+ &conf->fd_size,
+ sizeof(conf->fd_size)) ||
rib_write(BOOT_PATH "/dt/const/has_ttl",
&conf->has_ttl,
sizeof(conf->has_ttl)) ||
- rib_write(BOOT_PATH "/dt/const/has_chk",
- &conf->has_chk,
- sizeof(conf->has_chk)) ||
- rib_write(BOOT_PATH "/dt/const/min_pdu_size",
- &conf->min_pdu_size,
- sizeof(conf->min_pdu_size)) ||
- rib_write(BOOT_PATH "/dt/const/max_pdu_size",
- &conf->max_pdu_size,
- sizeof(conf->max_pdu_size)) ||
rib_write(BOOT_PATH "/dt/gam/type",
&conf->dt_gam_type,
sizeof(conf->dt_gam_type)) ||
@@ -355,7 +339,7 @@ static int normal_ipcp_bootstrap(const struct ipcp_config * conf)
return -1;
}
- log_dbg("Bootstrapped in DIF %s.", conf->dif_name);
+ log_dbg("Bootstrapped in DIF %s.", conf->dif_info.dif_name);
return 0;
}
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index 72889236..1696d0ad 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -758,7 +758,7 @@ static int eth_llc_ipcp_bootstrap(const struct ipcp_config * conf)
assert(conf);
assert(conf->type == THIS_TYPE);
- ipcpi.dir_hash_algo = conf->dir_hash_algo;
+ ipcpi.dir_hash_algo = conf->dif_info.dir_hash_algo;
if (conf->if_name == NULL) {
log_err("Interface name is NULL.");
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index a3e87b86..4ea0ad3d 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -534,7 +534,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)
assert(conf);
assert(conf->type == THIS_TYPE);
- ipcpi.dir_hash_algo = conf->dir_hash_algo;
+ ipcpi.dir_hash_algo = conf->dif_info.dir_hash_algo;
if (inet_ntop(AF_INET,
&conf->ip_addr,
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index 182970b1..28e91b18 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -241,14 +241,14 @@ int ipcp_enroll(pid_t api,
return ret;
}
- if (!recv_msg->has_dir_hash_algo || recv_msg->dif_name == NULL) {
+ if (recv_msg->dif_info == NULL) {
ipcp_msg__free_unpacked(recv_msg, NULL);
return -EIPCP;
}
- info->algo = recv_msg->dir_hash_algo;
+ info->dir_hash_algo = recv_msg->dif_info->dir_hash_algo;
- strcpy(info->dif_name, recv_msg->dif_name);
+ strcpy(info->dif_name, recv_msg->dif_info->dif_name);
ipcp_msg__free_unpacked(recv_msg, NULL);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 3331c754..b3243192 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -423,19 +423,19 @@ static int bootstrap_ipcp(pid_t api,
return -1;
}
- entry->dif_name = strdup(conf->dif_name);
+ entry->dif_name = strdup(conf->dif_info->dif_name);
if (entry->dif_name == NULL) {
pthread_rwlock_unlock(&irmd.reg_lock);
log_warn("Failed to set name of DIF.");
return -ENOMEM;
}
- entry->dir_hash_algo = conf->dir_hash_algo;
+ entry->dir_hash_algo = conf->dif_info->dir_hash_algo;
pthread_rwlock_unlock(&irmd.reg_lock);
log_info("Bootstrapped IPCP %d in DIF %s.",
- entry->api, conf->dif_name);
+ entry->api, conf->dif_info->dif_name);
return 0;
}
@@ -484,7 +484,7 @@ static int enroll_ipcp(pid_t api,
return -ENOMEM;
}
- entry->dir_hash_algo = info.algo;
+ entry->dir_hash_algo = info.dir_hash_algo;
pthread_rwlock_unlock(&irmd.reg_lock);
diff --git a/src/lib/cacep.proto b/src/lib/cacep.proto
index cdeaa0b7..8a159a35 100644
--- a/src/lib/cacep.proto
+++ b/src/lib/cacep.proto
@@ -23,12 +23,18 @@
syntax = "proto2";
+message fixed_conc_syntax_msg {
+ repeated uint32 fids = 1;
+ repeated uint32 lens = 2;
+}
+
message cacep_msg {
- required string ae_name = 1;
- required string protocol = 2;
- required int32 pref_version = 3;
- repeated int32 supp_version = 4;
- required int32 pref_syntax = 5;
- repeated int32 supp_syntax = 6;
- required uint64 address = 7;
+ required string ae_name = 1;
+ required string protocol = 2;
+ required int32 pref_version = 3;
+ repeated int32 supp_version = 4;
+ required int32 pref_syntax = 5;
+ repeated int32 supp_syntax = 6;
+ optional fixed_conc_syntax_msg syntax_spec = 7;
+ required uint64 address = 8;
} \ No newline at end of file
diff --git a/src/lib/ipcp_config.proto b/src/lib/ipcp_config.proto
index d5ff75d6..b6c8c303 100644
--- a/src/lib/ipcp_config.proto
+++ b/src/lib/ipcp_config.proto
@@ -23,25 +23,24 @@
syntax = "proto2";
+message dif_info_msg {
+ required string dif_name = 1;
+ required uint32 dir_hash_algo = 2;
+}
+
message ipcp_config_msg {
- required string dif_name = 1;
- required uint32 dir_hash_algo = 2;
- required int32 ipcp_type = 3;
+ required dif_info_msg dif_info = 1;
+ required int32 ipcp_type = 2;
// Config for normal IPCP
- optional uint32 addr_size = 4;
- optional uint32 cep_id_size = 5;
- optional uint32 pdu_length_size = 6;
- optional uint32 seqno_size = 7;
- optional bool has_ttl = 8;
- optional bool has_chk = 9;
- optional uint32 min_pdu_size = 10;
- optional uint32 max_pdu_size = 11;
- optional uint32 addr_auth_type = 12;
- optional uint32 dt_gam_type = 13;
- optional uint32 rm_gam_type = 14;
+ optional uint32 addr_size = 3;
+ optional uint32 fd_size = 4;
+ optional bool has_ttl = 5;
+ optional uint32 addr_auth_type = 6;
+ optional uint32 dt_gam_type = 7;
+ optional uint32 rm_gam_type = 8;
// Config for shim UDP
- optional uint32 ip_addr = 15;
- optional uint32 dns_addr = 16;
+ optional uint32 ip_addr = 9;
+ optional uint32 dns_addr = 10;
// Config for the shim Ethernet LLC
- optional string if_name = 17;
-} \ No newline at end of file
+ optional string if_name = 11;
+}
diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto
index 9299afcd..8a9ae214 100644
--- a/src/lib/ipcpd_messages.proto
+++ b/src/lib/ipcpd_messages.proto
@@ -38,16 +38,15 @@ enum ipcp_msg_code {
};
message ipcp_msg {
- required ipcp_msg_code code = 1;
- optional string name = 2;
- optional bytes hash = 3;
- optional int32 port_id = 4;
- optional string dst_name = 5;
- optional uint32 qoscube = 6;
- optional ipcp_config_msg conf = 7;
- optional int32 api = 8;
- optional int32 dir_hash_algo = 9;
- optional string dif_name = 10;
- optional int32 response = 11;
- optional int32 result = 12;
+ required ipcp_msg_code code = 1;
+ optional string name = 2;
+ optional bytes hash = 3;
+ optional int32 port_id = 4;
+ optional string dst_name = 5;
+ optional uint32 qoscube = 6;
+ optional ipcp_config_msg conf = 7;
+ optional int32 api = 8;
+ optional dif_info_msg dif_info = 9;
+ optional int32 response = 10;
+ optional int32 result = 11;
};
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 12d8e8f7..d2f85bbf 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -93,6 +93,7 @@ int irm_bootstrap_ipcp(pid_t api,
{
irm_msg_t msg = IRM_MSG__INIT;
ipcp_config_msg_t config = IPCP_CONFIG_MSG__INIT;
+ dif_info_msg_t dif_info = DIF_INFO_MSG__INIT;
irm_msg_t * recv_msg = NULL;
int ret = -1;
@@ -103,42 +104,34 @@ int irm_bootstrap_ipcp(pid_t api,
msg.has_api = true;
msg.api = api;
+ config.dif_info = &dif_info;
msg.conf = &config;
- config.dif_name = conf->dif_name;
+
+ dif_info.dif_name = (char *) conf->dif_info.dif_name;
+ dif_info.dir_hash_algo = conf->dif_info.dir_hash_algo;
+
config.ipcp_type = conf->type;
- config.dir_hash_algo = (enum hash_algo) conf->dir_hash_algo;
switch (conf->type) {
case IPCP_NORMAL:
- config.has_addr_size = true;
- config.has_cep_id_size = true;
- config.has_pdu_length_size = true;
- config.has_seqno_size = true;
- config.has_has_ttl = true;
- config.has_has_chk = true;
- config.has_min_pdu_size = true;
- config.has_max_pdu_size = true;
+ config.has_addr_size = true;
+ config.addr_size = conf->addr_size;
+ config.has_fd_size = true;
+ config.fd_size = conf->fd_size;
+ config.has_has_ttl = true;
+ config.has_ttl = conf->has_ttl;
config.has_addr_auth_type = true;
- config.has_dt_gam_type = true;
- config.has_rm_gam_type = true;
-
- config.addr_size = conf->addr_size;
- config.cep_id_size = conf->cep_id_size;
- config.pdu_length_size = conf->pdu_length_size;
- config.seqno_size = conf->seqno_size;
- config.has_ttl = conf->has_ttl;
- config.has_chk = conf->has_chk;
- config.min_pdu_size = conf->min_pdu_size;
- config.max_pdu_size = conf->max_pdu_size;
- config.addr_auth_type = conf->addr_auth_type;
- config.dt_gam_type = conf->dt_gam_type;
- config.rm_gam_type = conf->rm_gam_type;
+ config.addr_auth_type = conf->addr_auth_type;
+ config.has_dt_gam_type = true;
+ config.dt_gam_type = conf->dt_gam_type;
+ config.has_rm_gam_type = true;
+ config.rm_gam_type = conf->rm_gam_type;
break;
case IPCP_SHIM_UDP:
- config.has_ip_addr = true;
- config.ip_addr = conf->ip_addr;
+ config.has_ip_addr = true;
+ config.ip_addr = conf->ip_addr;
config.has_dns_addr = true;
- config.dns_addr = conf->dns_addr;
+ config.dns_addr = conf->dns_addr;
break;
case IPCP_LOCAL:
break;
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index 32c09b55..44fdfb3d 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -34,34 +34,30 @@
#include "irm_ops.h"
#include "irm_utils.h"
-#define NORMAL "normal"
-#define SHIM_UDP "shim-udp"
-#define SHIM_ETH_LLC "shim-eth-llc"
-#define LOCAL "local"
-
-#define CRC32 "CRC32"
-#define MD5 "MD5"
-#define SHA3_224 "SHA3_224"
-#define SHA3_256 "SHA3_256"
-#define SHA3_384 "SHA3_384"
-#define SHA3_512 "SHA3_512"
-
-#define DEFAULT_HASH_ALGO HASH_SHA3_256
-#define DEFAULT_HASH_STR SHA3_256
-#define DEFAULT_ADDR_SIZE 4
-#define DEFAULT_CEP_ID_SIZE 2
-#define DEFAULT_PDU_LEN_SIZE 2
-#define DEFAULT_SEQ_NO_SIZE 4
-#define DEFAULT_MIN_PDU_SIZE 0
-#define DEFAULT_MAX_PDU_SIZE 9000
-#define DEFAULT_DDNS 0
-#define DEFAULT_ADDR_AUTH FLAT_RANDOM
-#define DEFAULT_DT_GAM COMPLETE
-#define DEFAULT_RM_GAM COMPLETE
-#define ADDR_AUTH_FLAT "flat"
-
-#define DT_GAM_COMPLETE "complete"
-#define RM_GAM_COMPLETE "complete"
+#define NORMAL "normal"
+#define SHIM_UDP "shim-udp"
+#define SHIM_ETH_LLC "shim-eth-llc"
+#define LOCAL "local"
+
+#define CRC32 "CRC32"
+#define MD5 "MD5"
+#define SHA3_224 "SHA3_224"
+#define SHA3_256 "SHA3_256"
+#define SHA3_384 "SHA3_384"
+#define SHA3_512 "SHA3_512"
+
+#define DEFAULT_HASH_ALGO HASH_SHA3_256
+#define DEFAULT_HASH_STR SHA3_256
+#define DEFAULT_ADDR_SIZE 4
+#define DEFAULT_FD_SIZE 2
+#define DEFAULT_DDNS 0
+#define DEFAULT_ADDR_AUTH FLAT_RANDOM
+#define DEFAULT_DT_GAM COMPLETE
+#define DEFAULT_RM_GAM COMPLETE
+#define ADDR_AUTH_FLAT "flat"
+
+#define DT_GAM_COMPLETE "complete"
+#define RM_GAM_COMPLETE "complete"
static void usage(void)
{
@@ -77,13 +73,8 @@ static void usage(void)
SHA3_224 " " SHA3_256 " " SHA3_384 " " SHA3_512 "}.\n\n"
"if TYPE == " NORMAL "\n"
" [addr <address size> (default: %d)]\n"
- " [cep_id <CEP-id size> (default: %d)]\n"
- " [pdu_len <PDU length size> (default: %d)]\n"
- " [seqno <sequence number size> (default: %d)]\n"
+ " [fd <fd size> (default: %d)]\n"
" [ttl <add time to live value in the PCI>]\n"
- " [chk <add 32-bit checksum in the PCI>]\n"
- " [min_pdu <minimum PDU size> (default: %d)]\n"
- " [max_pdu <maximum PDU size> (default: %d)]\n"
" [addr_auth <address policy> (default: %s)]\n"
" [dt_gam <data transfer graph adjacency manager>"
" (default: %s)]\n"
@@ -95,37 +86,30 @@ static void usage(void)
" (default = none: %d)]\n"
"if TYPE == " SHIM_ETH_LLC "\n"
" if_name <interface name>\n",
- DEFAULT_HASH_STR, DEFAULT_ADDR_SIZE, DEFAULT_CEP_ID_SIZE,
- DEFAULT_PDU_LEN_SIZE, DEFAULT_SEQ_NO_SIZE,
- DEFAULT_MIN_PDU_SIZE, DEFAULT_MAX_PDU_SIZE,
+ DEFAULT_HASH_STR, DEFAULT_ADDR_SIZE, DEFAULT_FD_SIZE,
ADDR_AUTH_FLAT, DT_GAM_COMPLETE, RM_GAM_COMPLETE, DEFAULT_DDNS);
}
int do_bootstrap_ipcp(int argc, char ** argv)
{
- char * name = NULL;
- char * hash = DEFAULT_HASH_STR;
+ char * name = NULL;
+ char * hash = DEFAULT_HASH_STR;
pid_t api;
struct ipcp_config conf;
- uint8_t addr_size = DEFAULT_ADDR_SIZE;
- uint8_t cep_id_size = DEFAULT_CEP_ID_SIZE;
- uint8_t pdu_length_size = DEFAULT_PDU_LEN_SIZE;
- uint8_t seqno_size = DEFAULT_SEQ_NO_SIZE;
- bool has_ttl = false;
- bool has_chk = false;
- uint32_t min_pdu_size = DEFAULT_MIN_PDU_SIZE;
- uint32_t max_pdu_size = DEFAULT_MAX_PDU_SIZE;
- enum pol_addr_auth addr_auth_type = DEFAULT_ADDR_AUTH;
- enum pol_gam dt_gam_type = DEFAULT_DT_GAM;
- enum pol_gam rm_gam_type = DEFAULT_RM_GAM;
- uint32_t ip_addr = 0;
- uint32_t dns_addr = DEFAULT_DDNS;
- char * ipcp_type = NULL;
- char * dif_name = NULL;
- char * if_name = NULL;
- pid_t * apis = NULL;
- ssize_t len = 0;
- int i = 0;
+ uint8_t addr_size = DEFAULT_ADDR_SIZE;
+ uint8_t fd_size = DEFAULT_FD_SIZE;
+ bool has_ttl = false;
+ enum pol_addr_auth addr_auth_type = DEFAULT_ADDR_AUTH;
+ enum pol_gam dt_gam_type = DEFAULT_DT_GAM;
+ enum pol_gam rm_gam_type = DEFAULT_RM_GAM;
+ uint32_t ip_addr = 0;
+ uint32_t dns_addr = DEFAULT_DDNS;
+ char * ipcp_type = NULL;
+ char * dif_name = NULL;
+ char * if_name = NULL;
+ pid_t * apis = NULL;
+ ssize_t len = 0;
+ int i = 0;
while (argc > 0) {
if (matches(*argv, "type") == 0) {
@@ -150,24 +134,12 @@ int do_bootstrap_ipcp(int argc, char ** argv)
if_name = *(argv + 1);
} else if (matches(*argv, "addr") == 0) {
addr_size = atoi(*(argv + 1));
- } else if (matches(*argv, "cep_id") == 0) {
- cep_id_size = atoi(*(argv + 1));
- } else if (matches(*argv, "pdu_len") == 0) {
- pdu_length_size = atoi(*(argv + 1));
- } else if (matches(*argv, "seqno") == 0) {
- seqno_size = atoi(*(argv + 1));
+ } else if (matches(*argv, "fd") == 0) {
+ fd_size = atoi(*(argv + 1));
} else if (matches(*argv, "ttl") == 0) {
has_ttl = true;
argc++;
argv--;
- } else if (matches(*argv, "chk") == 0) {
- has_chk = true;
- argc++;
- argv--;
- } else if (matches(*argv, "min_pdu") == 0) {
- min_pdu_size = atoi(*(argv + 1));
- } else if (matches(*argv, "max_pdu") == 0) {
- max_pdu_size = atoi(*(argv + 1));
} else if (matches(*argv, "addr_auth") == 0) {
if (strcmp(ADDR_AUTH_FLAT, *(argv + 1)) == 0)
addr_auth_type = FLAT_RANDOM;
@@ -192,20 +164,20 @@ int do_bootstrap_ipcp(int argc, char ** argv)
return -1;
}
- conf.dif_name = dif_name;
+ strcpy(conf.dif_info.dif_name, dif_name);
if (strcmp(hash, CRC32) == 0) {
- conf.dir_hash_algo = HASH_CRC32;
+ conf.dif_info.dir_hash_algo = HASH_CRC32;
} else if (strcmp(hash, MD5) == 0) {
- conf.dir_hash_algo = HASH_MD5;
+ conf.dif_info.dir_hash_algo = HASH_MD5;
} else if (strcmp(hash, SHA3_224) == 0) {
- conf.dir_hash_algo = HASH_SHA3_224;
+ conf.dif_info.dir_hash_algo = HASH_SHA3_224;
} else if (strcmp(hash, SHA3_256) == 0) {
- conf.dir_hash_algo = HASH_SHA3_256;
+ conf.dif_info.dir_hash_algo = HASH_SHA3_256;
} else if (strcmp(hash, SHA3_384) == 0) {
- conf.dir_hash_algo = HASH_SHA3_384;
+ conf.dif_info.dir_hash_algo = HASH_SHA3_384;
} else if (strcmp(hash, SHA3_512) == 0) {
- conf.dir_hash_algo = HASH_SHA3_512;
+ conf.dif_info.dir_hash_algo = HASH_SHA3_512;
} else {
usage();
return -1;
@@ -214,13 +186,8 @@ int do_bootstrap_ipcp(int argc, char ** argv)
if (strcmp(ipcp_type, NORMAL) == 0) {
conf.type = IPCP_NORMAL;
conf.addr_size = addr_size;
- conf.cep_id_size = cep_id_size;
- conf.pdu_length_size = pdu_length_size;
- conf.seqno_size = seqno_size;
+ conf.fd_size = fd_size;
conf.has_ttl = has_ttl;
- conf.has_chk = has_chk;
- conf.min_pdu_size = min_pdu_size;
- conf.max_pdu_size = max_pdu_size;
conf.addr_auth_type = addr_auth_type;
conf.dt_gam_type = dt_gam_type;
conf.rm_gam_type = rm_gam_type;