summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-02-12 22:31:18 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-02-16 18:21:41 +0100
commit0ae1f0dd600f6c21c34565cf4dc0c5ef0ae42709 (patch)
tree023e611cb59e4e14f03adaffa15190c835f80814 /src/ipcpd
parent71eeedd1a05d5dd200c77527ea15086bf43e1a26 (diff)
downloadouroboros-0ae1f0dd600f6c21c34565cf4dc0c5ef0ae42709.tar.gz
ouroboros-0ae1f0dd600f6c21c34565cf4dc0c5ef0ae42709.zip
ipcpd: Configure PFF from routing policy
The Packet Forwarding Function (PFF) was user-configurable using the irm tool. However, this isn't really wanted since the PFF is dictated by the routing algorithm. This moves the responsability for selecting the correct PFF from the network admin to the unicast IPCP implementation. Each routing policy now has to specify which PFF it will use. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/ipcp.c1
-rw-r--r--src/ipcpd/unicast/dt.c5
-rw-r--r--src/ipcpd/unicast/dt.h1
-rw-r--r--src/ipcpd/unicast/enroll.c3
-rw-r--r--src/ipcpd/unicast/main.c1
-rw-r--r--src/ipcpd/unicast/pff.h5
-rw-r--r--src/ipcpd/unicast/routing.c12
7 files changed, 19 insertions, 9 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index f826379d..8f9fcd7d 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -241,7 +241,6 @@ static void * mainloop(void * o)
conf.max_ttl = conf_msg->max_ttl;
conf.addr_auth_type = conf_msg->addr_auth_type;
conf.routing_type = conf_msg->routing_type;
- conf.pff_type = conf_msg->pff_type;
break;
case IPCP_ETH_DIX:
conf.ethertype = conf_msg->ethertype;
diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c
index cabc159d..ee14d28e 100644
--- a/src/ipcpd/unicast/dt.c
+++ b/src/ipcpd/unicast/dt.c
@@ -621,7 +621,6 @@ static void * dt_conn_handle(void * o)
}
int dt_init(enum pol_routing pr,
- enum pol_pff pp,
uint8_t addr_size,
uint8_t eid_size,
uint8_t max_ttl)
@@ -629,6 +628,7 @@ int dt_init(enum pol_routing pr,
int i;
int j;
char dtstr[256];
+ enum pol_pff pp;
struct conn_info info;
memset(&info, 0, sizeof(info));
@@ -659,7 +659,8 @@ int dt_init(enum pol_routing pr,
goto fail_connmgr_comp_init;
}
- if (routing_init(pr)) {
+ pp = routing_init(pr);
+ if (pp < 0) {
log_err("Failed to init routing.");
goto fail_routing;
}
diff --git a/src/ipcpd/unicast/dt.h b/src/ipcpd/unicast/dt.h
index 15a7b660..73b71a92 100644
--- a/src/ipcpd/unicast/dt.h
+++ b/src/ipcpd/unicast/dt.h
@@ -32,7 +32,6 @@
#define INVALID_ADDR 0
int dt_init(enum pol_routing pr,
- enum pol_pff pp,
uint8_t addr_size,
uint8_t eid_size,
uint8_t max_ttl
diff --git a/src/ipcpd/unicast/enroll.c b/src/ipcpd/unicast/enroll.c
index 582e808f..6a612ff3 100644
--- a/src/ipcpd/unicast/enroll.c
+++ b/src/ipcpd/unicast/enroll.c
@@ -136,7 +136,6 @@ static int send_rcv_enroll_msg(int fd)
enroll.conf.max_ttl = reply->conf->max_ttl;
enroll.conf.addr_auth_type = reply->conf->addr_auth_type;
enroll.conf.routing_type = reply->conf->routing_type;
- enroll.conf.pff_type = reply->conf->pff_type;
enroll.conf.layer_info.dir_hash_algo
= reply->conf->layer_info->dir_hash_algo;
@@ -173,8 +172,6 @@ static ssize_t enroll_pack(uint8_t ** buf)
config.addr_auth_type = enroll.conf.addr_auth_type;
config.has_routing_type = true;
config.routing_type = enroll.conf.routing_type;
- config.has_pff_type = true;
- config.pff_type = enroll.conf.pff_type;
config.layer_info = &layer_info;
layer_info.layer_name = (char *) enroll.conf.layer_info.layer_name;
diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c
index 33295e29..43052209 100644
--- a/src/ipcpd/unicast/main.c
+++ b/src/ipcpd/unicast/main.c
@@ -82,7 +82,6 @@ static int initialize_components(const struct ipcp_config * conf)
log_dbg("IPCP got address %" PRIu64 ".", ipcpi.dt_addr);
if (dt_init(conf->routing_type,
- conf->pff_type,
conf->addr_size,
conf->eid_size,
conf->max_ttl)) {
diff --git a/src/ipcpd/unicast/pff.h b/src/ipcpd/unicast/pff.h
index d88ffa7f..a7b618dc 100644
--- a/src/ipcpd/unicast/pff.h
+++ b/src/ipcpd/unicast/pff.h
@@ -29,6 +29,11 @@
#include <stdlib.h>
#include <stdbool.h>
+enum pol_pff {
+ PFF_SIMPLE = 0,
+ PFF_ALTERNATE
+};
+
struct pff * pff_create(enum pol_pff pol);
void pff_destroy(struct pff * pff);
diff --git a/src/ipcpd/unicast/routing.c b/src/ipcpd/unicast/routing.c
index 1d660cde..0794555e 100644
--- a/src/ipcpd/unicast/routing.c
+++ b/src/ipcpd/unicast/routing.c
@@ -24,6 +24,7 @@
#include <ouroboros/errno.h>
+#include "pff.h"
#include "routing.h"
#include "pol/link_state.h"
@@ -31,16 +32,25 @@ struct pol_routing_ops * r_ops;
int routing_init(enum pol_routing pr)
{
+ enum pol_pff pff_type;
+
switch (pr) {
case ROUTING_LINK_STATE:
+ pff_type = PFF_SIMPLE;
+ r_ops = &link_state_ops;
+ break;
case ROUTING_LINK_STATE_LFA:
+ pff_type = PFF_ALTERNATE;
r_ops = &link_state_ops;
break;
default:
return -ENOTSUP;
}
- return r_ops->init(pr);
+ if (r_ops->init(pr))
+ return -1;
+
+ return pff_type;
}
struct routing_i * routing_i_create(struct pff * pff)