summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2020-02-12 22:31:18 +0100
committerSander Vrijders <[email protected]>2020-02-16 18:21:41 +0100
commit0ae1f0dd600f6c21c34565cf4dc0c5ef0ae42709 (patch)
tree023e611cb59e4e14f03adaffa15190c835f80814
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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
-rw-r--r--include/ouroboros/ipcp.h6
-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
-rw-r--r--src/lib/ipcp_config.proto13
-rw-r--r--src/lib/irm.c2
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c16
11 files changed, 26 insertions, 39 deletions
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index c82a313e..71607646 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -54,11 +54,6 @@ enum pol_routing {
ROUTING_LINK_STATE_LFA
};
-enum pol_pff {
- PFF_SIMPLE = 0,
- PFF_ALTERNATE
-};
-
enum pol_dir_hash {
DIR_HASH_SHA3_224 = 0,
DIR_HASH_SHA3_256,
@@ -85,7 +80,6 @@ struct ipcp_config {
enum pol_addr_auth addr_auth_type;
enum pol_routing routing_type;
- enum pol_pff pff_type;
/* UDP */
uint32_t ip_addr;
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)
diff --git a/src/lib/ipcp_config.proto b/src/lib/ipcp_config.proto
index 17d1c47e..23c65e94 100644
--- a/src/lib/ipcp_config.proto
+++ b/src/lib/ipcp_config.proto
@@ -36,16 +36,15 @@ message ipcp_config_msg {
optional uint32 max_ttl = 5;
optional uint32 addr_auth_type = 6;
optional uint32 routing_type = 7;
- optional uint32 pff_type = 8;
// Config for UDP
- optional uint32 ip_addr = 9;
- optional uint32 dns_addr = 10;
- optional uint32 clt_port = 11;
- optional uint32 srv_port = 12;
+ optional uint32 ip_addr = 8;
+ optional uint32 dns_addr = 9;
+ optional uint32 clt_port = 10;
+ optional uint32 srv_port = 11;
// Config for the Ethernet
- optional string dev = 13;
+ optional string dev = 12;
// Config for DIX Ethernet
- optional uint32 ethertype = 14;
+ optional uint32 ethertype = 13;
}
enum enroll_code {
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 9b74c72d..e4b39f2c 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -132,8 +132,6 @@ int irm_bootstrap_ipcp(pid_t pid,
config.addr_auth_type = conf->addr_auth_type;
config.has_routing_type = true;
config.routing_type = conf->routing_type;
- config.has_pff_type = true;
- config.pff_type = conf->pff_type;
break;
case IPCP_UDP:
config.has_ip_addr = true;
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index e58a4765..7b844ba7 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -70,7 +70,6 @@
#define DEFAULT_TTL 60
#define DEFAULT_ADDR_AUTH ADDR_AUTH_FLAT_RANDOM
#define DEFAULT_ROUTING ROUTING_LINK_STATE
-#define DEFAULT_PFF PFF_SIMPLE
#define DEFAULT_HASH_ALGO DIR_HASH_SHA3_256
#define DEFAULT_ETHERTYPE 0xA000
#define DEFAULT_CLIENT_PORT 0x0000 /* random port */
@@ -79,8 +78,6 @@
#define FLAT_RANDOM_ADDR_AUTH "flat"
#define LINK_STATE_ROUTING "link_state"
#define LINK_STATE_LFA_ROUTING "lfa"
-#define SIMPLE_PFF "simple"
-#define ALTERNATE_PFF "alternate"
static void usage(void)
{
@@ -97,13 +94,11 @@ static void usage(void)
" [ttl (max time-to-live value, default: %d)]\n"
" [addr_auth <ADDRESS_POLICY> (default: %s)]\n"
" [routing <ROUTING_POLICY> (default: %s)]\n"
- " [pff [PFF_POLICY] (default: %s)]\n"
" [hash [ALGORITHM] (default: %s)]\n"
" [autobind]\n"
"where ADDRESS_POLICY = {"FLAT_RANDOM_ADDR_AUTH"}\n"
" ROUTING_POLICY = {"LINK_STATE_ROUTING " "
LINK_STATE_LFA_ROUTING "}\n"
- " PFF_POLICY = {" SIMPLE_PFF " " ALTERNATE_PFF "}\n"
" ALGORITHM = {" SHA3_224 " " SHA3_256 " "
SHA3_384 " " SHA3_512 "}\n\n"
"if TYPE == " UDP "\n"
@@ -134,7 +129,7 @@ static void usage(void)
"if TYPE == " BROADCAST "\n"
" [autobind]\n\n",
DEFAULT_ADDR_SIZE, DEFAULT_EID_SIZE, DEFAULT_TTL,
- FLAT_RANDOM_ADDR_AUTH, LINK_STATE_ROUTING, SIMPLE_PFF,
+ FLAT_RANDOM_ADDR_AUTH, LINK_STATE_ROUTING,
SHA3_256, DEFAULT_SERVER_PORT, SHA3_256, 0xA000, SHA3_256,
SHA3_256, SHA3_256);
}
@@ -150,7 +145,6 @@ int do_bootstrap_ipcp(int argc,
uint8_t max_ttl = DEFAULT_TTL;
enum pol_addr_auth addr_auth_type = DEFAULT_ADDR_AUTH;
enum pol_routing routing_type = DEFAULT_ROUTING;
- enum pol_pff pff_type = DEFAULT_PFF;
enum pol_dir_hash hash_algo = DEFAULT_HASH_ALGO;
uint32_t ip_addr = 0;
uint32_t dns_addr = DEFAULT_DDNS;
@@ -232,13 +226,6 @@ int do_bootstrap_ipcp(int argc,
routing_type = ROUTING_LINK_STATE_LFA;
else
goto unknown_param;
- } else if (matches(*argv, "pff") == 0) {
- if (strcmp(SIMPLE_PFF, *(argv + 1)) == 0)
- pff_type = PFF_SIMPLE;
- else if (strcmp(ALTERNATE_PFF, *(argv + 1)) == 0)
- pff_type = PFF_ALTERNATE;
- else
- goto unknown_param;
} else {
printf("Unknown option: \"%s\".\n", *argv);
return -1;
@@ -324,7 +311,6 @@ int do_bootstrap_ipcp(int argc,
conf.max_ttl = max_ttl;
conf.addr_auth_type = addr_auth_type;
conf.routing_type = routing_type;
- conf.pff_type = pff_type;
break;
case IPCP_UDP:
if (ip_addr == 0)