From 0ae1f0dd600f6c21c34565cf4dc0c5ef0ae42709 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 12 Feb 2020 22:31:18 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/ipcpd/ipcp.c | 1 - src/ipcpd/unicast/dt.c | 5 +++-- src/ipcpd/unicast/dt.h | 1 - src/ipcpd/unicast/enroll.c | 3 --- src/ipcpd/unicast/main.c | 1 - src/ipcpd/unicast/pff.h | 5 +++++ src/ipcpd/unicast/routing.c | 12 +++++++++++- 7 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index f826379..8f9fcd7 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 cabc159..ee14d28 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 15a7b66..73b71a9 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 582e808..6a612ff 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 33295e2..4305220 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 d88ffa7..a7b618d 100644 --- a/src/ipcpd/unicast/pff.h +++ b/src/ipcpd/unicast/pff.h @@ -29,6 +29,11 @@ #include #include +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 1d660cd..0794555 100644 --- a/src/ipcpd/unicast/routing.c +++ b/src/ipcpd/unicast/routing.c @@ -24,6 +24,7 @@ #include +#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) -- cgit v1.1