summaryrefslogtreecommitdiff
path: root/src/tools/irm
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2023-02-12 21:05:40 +0100
committerSander Vrijders <sander@ouroboros.rocks>2023-02-13 21:10:11 +0100
commit269f25d3bac5ab871d8044935eacc15cfeadeec6 (patch)
treed68cba31a7a4b941658836d0c0d616fc7ec6400b /src/tools/irm
parentc3814fa77eb7afbe6e798ded0fdff2df74ad8642 (diff)
downloadouroboros-269f25d3bac5ab871d8044935eacc15cfeadeec6.tar.gz
ouroboros-269f25d3bac5ab871d8044935eacc15cfeadeec6.zip
ipcpd: refactor IPCP configuration
The ipcp configuration struct now has internal structures for the different IPCPs and for IPCP components of the unicast IPCP. Split the very long IPCP main loop into individual handler functions. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/tools/irm')
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index 32b3cea3..2e90b82c 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -292,6 +292,7 @@ int do_bootstrap_ipcp(int argc,
printf("Types do not match.\n\n");
goto fail;
}
+
conf.type = ipcps[i].type;
if (autobind && (conf.type != IPCP_UNICAST &&
@@ -302,40 +303,36 @@ int do_bootstrap_ipcp(int argc,
}
if (strlen(layer) > LAYER_NAME_SIZE) {
- printf("Layer name too big.\n\n");
+ printf("Layer name too long.\n\n");
goto fail_usage;
}
strcpy(conf.layer_info.layer_name, layer);
- if (conf.type != IPCP_UDP)
- conf.layer_info.dir_hash_algo = hash_algo;
+ conf.layer_info.dir_hash_algo = hash_algo;
switch (conf.type) {
case IPCP_UNICAST:
- conf.addr_size = addr_size;
- conf.eid_size = eid_size;
- conf.max_ttl = max_ttl;
- conf.addr_auth_type = addr_auth_type;
- conf.routing_type = routing_type;
- conf.cong_avoid = cong_avoid;
+ conf.unicast.dt.addr_size = addr_size;
+ conf.unicast.dt.eid_size = eid_size;
+ conf.unicast.dt.max_ttl = max_ttl;
+ conf.unicast.dt.routing_type = routing_type;
+ conf.unicast.addr_auth_type = addr_auth_type;
+ conf.unicast.cong_avoid = cong_avoid;
break;
case IPCP_UDP:
if (ip_addr == 0)
goto fail_usage;
- conf.ip_addr = ip_addr;
- conf.dns_addr = dns_addr;
- conf.port = port;
- break;
- case IPCP_ETH_LLC:
- if (dev == NULL)
- goto fail_usage;
- conf.dev = dev;
+ conf.udp.ip_addr = ip_addr;
+ conf.udp.dns_addr = dns_addr;
+ conf.udp.port = port;
break;
case IPCP_ETH_DIX:
+ conf.eth.ethertype = ethertype;
+ /* FALLTHRU */
+ case IPCP_ETH_LLC:
if (dev == NULL)
goto fail_usage;
- conf.dev = dev;
- conf.ethertype = ethertype;
+ conf.eth.dev = dev;
break;
case IPCP_BROADCAST:
/* FALLTHRU */