summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-20 15:05:00 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-20 15:05:00 +0000
commit16db00220f6fd1be618f4a38272888f6ac144d20 (patch)
tree5a1f3d4aa8640d0e1e182d33923ec27b30cf7f3f /src/ipcpd/normal
parentee47a0c6478ab4e6478ad3b7fe5a35eb5775decb (diff)
parent86f4814245998f4b43e136101897557e4c2f5e54 (diff)
downloadouroboros-16db00220f6fd1be618f4a38272888f6ac144d20.tar.gz
ouroboros-16db00220f6fd1be618f4a38272888f6ac144d20.zip
Merged in dstaesse/ouroboros/be-cacep (pull request #381)
lib: Revise CACEP
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/gam.c68
-rw-r--r--src/ipcpd/normal/main.c2
2 files changed, 30 insertions, 40 deletions
diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c
index 9ee55261..bc71f0d8 100644
--- a/src/ipcpd/normal/gam.c
+++ b/src/ipcpd/normal/gam.c
@@ -178,8 +178,12 @@ int gam_flow_arr(struct gam * instance,
int fd,
qosspec_t qs)
{
- struct cacep * cacep;
- struct cacep_info * info;
+ struct cacep_info * rcv_info;
+ struct cacep_info snd_info;
+
+ snd_info.name = ipcpi.name;
+ snd_info.addr = ipcpi.address;
+ snd_info.data = NULL;
if (flow_alloc_resp(fd, instance->ops->accept_new_flow(instance->ops_o))
< 0) {
@@ -187,32 +191,23 @@ int gam_flow_arr(struct gam * instance,
return -1;
}
- cacep = cacep_create(fd, ipcpi.name, ipcpi.address);
- if (cacep == NULL) {
- log_err("Failed to create CACEP instance.");
- return -1;
- }
-
- info = cacep_auth_wait(cacep);
- if (info == NULL) {
+ rcv_info = cacep_auth_wait(fd, SIMPLE_AUTH, &snd_info);
+ if (rcv_info == NULL) {
log_err("Other side failed to authenticate.");
- cacep_destroy(cacep);
return -1;
}
- cacep_destroy(cacep);
-
- if (instance->ops->accept_flow(instance->ops_o, qs, info)) {
+ if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) {
flow_dealloc(fd);
- free(info->name);
- free(info);
+ free(rcv_info->name);
+ free(rcv_info);
return 0;
}
- if (add_ga(instance, fd, qs, info)) {
+ if (add_ga(instance, fd, qs, rcv_info)) {
log_err("Failed to add ga to graph adjacency manager list.");
- free(info->name);
- free(info);
+ free(rcv_info->name);
+ free(rcv_info);
return -1;
}
@@ -223,10 +218,14 @@ int gam_flow_alloc(struct gam * instance,
char * dst_name,
qosspec_t qs)
{
- struct cacep * cacep;
- struct cacep_info * info;
+ struct cacep_info * rcv_info;
+ struct cacep_info snd_info;
int fd;
+ snd_info.name = ipcpi.name;
+ snd_info.addr = ipcpi.address;
+ snd_info.data = NULL;
+
fd = flow_alloc(dst_name, instance->ae_name, NULL);
if (fd < 0) {
log_err("Failed to allocate flow to %s.", dst_name);
@@ -239,32 +238,23 @@ int gam_flow_alloc(struct gam * instance,
return -1;
}
- cacep = cacep_create(fd, ipcpi.name, ipcpi.address);
- if (cacep == NULL) {
- log_err("Failed to create CACEP instance.");
- return -1;
- }
-
- info = cacep_auth(cacep);
- if (info == NULL) {
- log_err("Failed to authenticate.");
- cacep_destroy(cacep);
+ rcv_info = cacep_auth(fd, SIMPLE_AUTH, &snd_info);
+ if (rcv_info == NULL) {
+ log_err("Other side failed to authenticate.");
return -1;
}
- cacep_destroy(cacep);
-
- if (instance->ops->accept_flow(instance->ops_o, qs, info)) {
+ if (instance->ops->accept_flow(instance->ops_o, qs, rcv_info)) {
flow_dealloc(fd);
- free(info->name);
- free(info);
+ free(rcv_info->name);
+ free(rcv_info);
return 0;
}
- if (add_ga(instance, fd, qs, info)) {
+ if (add_ga(instance, fd, qs, rcv_info)) {
log_err("Failed to add GA to graph adjacency manager list.");
- free(info->name);
- free(info);
+ free(rcv_info->name);
+ free(rcv_info);
return -1;
}
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index e3955ff2..74a74c5b 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -340,7 +340,7 @@ int normal_rib_init(void)
static int normal_ipcp_bootstrap(struct dif_config * conf)
{
/* FIXME: get CACEP policies from conf */
- enum pol_cacep pol = NO_AUTH;
+ enum pol_cacep pol = SIMPLE_AUTH;
(void) pol;