diff options
Diffstat (limited to 'src/tools/irm')
26 files changed, 290 insertions, 289 deletions
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c index 2388bfd9..ba0f4713 100644 --- a/src/tools/irm/irm.c +++ b/src/tools/irm/irm.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * A tool to instruct the IRM daemon * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,7 +49,7 @@ static void usage(void) { printf("Usage: irm [OPERATION]\n\n" - "where OPERATION = {ipcp bind unbind name}\n"); + "where OPERATION in { ipcp bind unbind name }\n"); } static int do_help(int argc, diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c index 2715b48e..2e8b14ef 100644 --- a/src/tools/irm/irm_bind.c +++ b/src/tools/irm/irm_bind.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bind names in the processing system * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,7 +47,7 @@ static void usage(void) { printf("Usage: irm bind [OPERATION]\n" "\n" - "where OPERATION = {program process ipcp help}\n"); + "where OPERATION in {program process ipcp help}\n"); } static int do_help(int argc, diff --git a/src/tools/irm/irm_bind_ipcp.c b/src/tools/irm/irm_bind_ipcp.c index 4f3f11b2..7d5dd636 100644 --- a/src/tools/irm/irm_bind_ipcp.c +++ b/src/tools/irm/irm_bind_ipcp.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bind IPCP Instance to a name * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,11 +55,11 @@ static void usage(void) int do_bind_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - char * name = NULL; - struct ipcp_info * ipcps; - ssize_t len; - ssize_t i; + char * ipcp = NULL; + char * name = NULL; + struct ipcp_list_info * ipcps; + ssize_t len; + ssize_t i; while (argc > 0) { if (matches(*argv, "name") == 0) { diff --git a/src/tools/irm/irm_bind_process.c b/src/tools/irm/irm_bind_process.c index a45942b0..fffd5fe9 100644 --- a/src/tools/irm/irm_bind_process.c +++ b/src/tools/irm/irm_bind_process.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bind a process to a name * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_bind_program.c b/src/tools/irm/irm_bind_program.c index 7c62f6a1..8a0dc33c 100644 --- a/src/tools/irm/irm_bind_program.c +++ b/src/tools/irm/irm_bind_program.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bind programs to a name * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c index 12e79c29..63e617d9 100644 --- a/src/tools/irm/irm_ipcp.c +++ b/src/tools/irm/irm_ipcp.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * A tool to instruct the IRM daemon * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -44,10 +44,11 @@ static void usage(void) { printf("Usage: irm ipcp [OPERATION]\n\n" - "where OPERATION = {create destroy\n" - " bootstrap enroll\n" - " connect disconnect\n" - " list help}\n"); + "where OPERATION in {create destroy\n" + " bootstrap enroll\n" + " connect disconnect\n" + " list\n" + " help}\n"); } static int do_help(int argc, char **argv) diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c index 84b6759a..b8e5c54d 100644 --- a/src/tools/irm/irm_ipcp_bootstrap.c +++ b/src/tools/irm/irm_ipcp_bootstrap.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bootstrap IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,13 +50,12 @@ #include <sys/socket.h> #endif -#define UNICAST "unicast" +#define UNICAST "unicast" #define BROADCAST "broadcast" #define UDP "udp" #define ETH_LLC "eth-llc" #define ETH_DIX "eth-dix" #define LOCAL "local" -#define RAPTOR "raptor" #define MD5 "MD5" #define SHA3_224 "SHA3_224" @@ -65,20 +64,22 @@ #define SHA3_512 "SHA3_512" #define DEFAULT_ADDR_SIZE 4 -#define DEFAULT_EID_SIZE 2 +#define DEFAULT_EID_SIZE 8 #define DEFAULT_DDNS 0 #define DEFAULT_TTL 60 #define DEFAULT_ADDR_AUTH ADDR_AUTH_FLAT_RANDOM #define DEFAULT_ROUTING ROUTING_LINK_STATE +#define DEFAULT_CONG_AVOID CA_MB_ECN #define DEFAULT_HASH_ALGO DIR_HASH_SHA3_256 #define DEFAULT_ETHERTYPE 0xA000 -#define DEFAULT_CLIENT_PORT 0x0000 /* random port */ -#define DEFAULT_SERVER_PORT 0x0D6B /* 3435 */ +#define DEFAULT_UDP_PORT 0x0D6B /* 3435 */ #define FLAT_RANDOM_ADDR_AUTH "flat" #define LINK_STATE_ROUTING "link_state" #define LINK_STATE_LFA_ROUTING "lfa" #define LINK_STATE_ECM_ROUTING "ecmp" +#define NONE_CA "none" +#define MB_ECN_CA "mb-ecn" static void usage(void) { @@ -87,80 +88,77 @@ static void usage(void) " name <ipcp name>\n" " layer <layer name>\n" " [type [TYPE]]\n" - "where TYPE = {" UNICAST " " BROADCAST " " LOCAL " " - UDP " " ETH_LLC " " ETH_DIX " " RAPTOR "},\n\n" + "where TYPE in {" UNICAST " " BROADCAST " " LOCAL " " + UDP " " ETH_LLC " " ETH_DIX "},\n\n" "if TYPE == " UNICAST "\n" " [addr <address size> (default: %d)]\n" " [eid <eid size> (default: %d)]\n" " [ttl (max time-to-live value, default: %d)]\n" " [addr_auth <ADDRESS_POLICY> (default: %s)]\n" " [routing <ROUTING_POLICY> (default: %s)]\n" + " [congestion <CONG_POLICY> (default: %s)]\n" " [hash [ALGORITHM] (default: %s)]\n" " [autobind]\n" - "where ADDRESS_POLICY = {"FLAT_RANDOM_ADDR_AUTH"}\n" - " ROUTING_POLICY = {"LINK_STATE_ROUTING " " + "where ADDRESS_POLICY in {" FLAT_RANDOM_ADDR_AUTH "}\n" + " ROUTING_POLICY in {" LINK_STATE_ROUTING " " LINK_STATE_LFA_ROUTING " " LINK_STATE_ECM_ROUTING "}\n" - " ALGORITHM = {" SHA3_224 " " SHA3_256 " " + " CONG_POLICY in {" NONE_CA " " MB_ECN_CA "}\n" + " ALGORITHM in {" SHA3_224 " " SHA3_256 " " SHA3_384 " " SHA3_512 "}\n\n" "if TYPE == " UDP "\n" " ip <IP address in dotted notation>\n" - " [cport <client port> (default: random)]\n" - " [sport <server port> (default: %d)]\n" + " [port <UDP port> (default: %d)]\n" " [dns <DDNS IP address in dotted notation>" " (default: none)]\n\n" "if TYPE == " ETH_LLC "\n" " dev <interface name>\n" " [hash [ALGORITHM] (default: %s)]\n" - "where ALGORITHM = {" SHA3_224 " " SHA3_256 " " + "where ALGORITHM in {" SHA3_224 " " SHA3_256 " " SHA3_384 " " SHA3_512 "}\n\n" "if TYPE == " ETH_DIX "\n" " dev <interface name>\n" " [ethertype <ethertype> (default: 0x%4X)]\n" " [hash [ALGORITHM] (default: %s)]\n" - "where ALGORITHM = {" SHA3_224 " " SHA3_256 " " + "where ALGORITHM in {" SHA3_224 " " SHA3_256 " " SHA3_384 " " SHA3_512 "}\n\n" "if TYPE == " LOCAL "\n" " [hash [ALGORITHM] (default: %s)]\n" - "where ALGORITHM = {" SHA3_224 " " SHA3_256 " " - SHA3_384 " " SHA3_512 "}\n\n" - "if TYPE == " RAPTOR "\n" - " [hash [ALGORITHM] (default: %s)]\n" - "where ALGORITHM = {" SHA3_224 " " SHA3_256 " " + "where ALGORITHM in {" SHA3_224 " " SHA3_256 " " SHA3_384 " " SHA3_512 "}\n\n" "if TYPE == " BROADCAST "\n" " [autobind]\n\n", DEFAULT_ADDR_SIZE, DEFAULT_EID_SIZE, DEFAULT_TTL, - FLAT_RANDOM_ADDR_AUTH, LINK_STATE_ROUTING, - SHA3_256, DEFAULT_SERVER_PORT, SHA3_256, 0xA000, SHA3_256, - SHA3_256, SHA3_256); + FLAT_RANDOM_ADDR_AUTH, LINK_STATE_ROUTING, MB_ECN_CA, + SHA3_256, DEFAULT_UDP_PORT, SHA3_256, 0xA000, SHA3_256, + SHA3_256); } int do_bootstrap_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - pid_t pid = -1; - struct ipcp_config conf; - uint8_t addr_size = DEFAULT_ADDR_SIZE; - uint8_t eid_size = DEFAULT_EID_SIZE; - 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_dir_hash hash_algo = DEFAULT_HASH_ALGO; - uint32_t ip_addr = 0; - uint32_t dns_addr = DEFAULT_DDNS; - char * ipcp_type = NULL; - enum ipcp_type type = IPCP_INVALID; - char * layer = NULL; - char * dev = NULL; - uint16_t ethertype = DEFAULT_ETHERTYPE; - struct ipcp_info * ipcps; - ssize_t len = 0; - int i = 0; - bool autobind = false; - int cargs; - int cport = DEFAULT_CLIENT_PORT; - int sport = DEFAULT_SERVER_PORT; + char * ipcp = NULL; + pid_t pid = -1; + struct ipcp_config conf; + uint8_t addr_size = DEFAULT_ADDR_SIZE; + uint8_t eid_size = DEFAULT_EID_SIZE; + 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_dir_hash hash_algo = DEFAULT_HASH_ALGO; + enum pol_cong_avoid cong_avoid = DEFAULT_CONG_AVOID; + uint32_t ip_addr = 0; + uint32_t dns_addr = DEFAULT_DDNS; + char * ipcp_type = NULL; + enum ipcp_type type = IPCP_INVALID; + char * layer = NULL; + char * dev = NULL; + uint16_t ethertype = DEFAULT_ETHERTYPE; + struct ipcp_list_info * ipcps; + ssize_t len = 0; + int i = 0; + bool autobind = false; + int cargs; + int port = DEFAULT_UDP_PORT; while (argc > 0) { cargs = 2; @@ -195,7 +193,7 @@ int do_bootstrap_ipcp(int argc, ethertype = strtol(*(argv + 1), NULL, 0); else ethertype = strtol(*(argv + 1), NULL, 16); - if (ethertype < 0x0600 || ethertype == 0xFFFF) { + if (ethertype < 0x0600 || ethertype >= 0xFFFF) { printf("Invalid Ethertype: \"%s\".\n" "Recommended range: 0xA000-0xEFFF.\n", *(argv + 1)); @@ -207,10 +205,8 @@ int do_bootstrap_ipcp(int argc, eid_size = atoi(*(argv + 1)); } else if (matches(*argv, "ttl") == 0) { max_ttl = atoi(*(argv + 1)); - } else if (matches(*argv, "cport") == 0) { - cport = atoi(*(argv + 1)); - } else if (matches(*argv, "sport") == 0) { - sport = atoi(*(argv + 1)); + } else if (matches(*argv, "port") == 0) { + port = atoi(*(argv + 1)); } else if (matches(*argv, "autobind") == 0) { autobind = true; cargs = 1; @@ -230,6 +226,14 @@ int do_bootstrap_ipcp(int argc, routing_type = ROUTING_LINK_STATE_ECMP; else goto unknown_param; + } else if (matches(*argv, "congestion") == 0) { + if (strcmp(NONE_CA, *(argv + 1)) == 0) + cong_avoid = CA_NONE; + else if (strcmp(MB_ECN_CA, + *(argv + 1)) == 0) + cong_avoid = CA_MB_ECN; + else + goto unknown_param; } else { printf("Unknown option: \"%s\".\n", *argv); return -1; @@ -265,8 +269,6 @@ int do_bootstrap_ipcp(int argc, type = IPCP_ETH_DIX; else if (strcmp(ipcp_type, LOCAL) == 0) type = IPCP_LOCAL; - else if (strcmp(ipcp_type, RAPTOR) == 0) - type = IPCP_RAPTOR; else goto fail_usage; } @@ -290,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 && @@ -300,46 +303,45 @@ 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; + strcpy(conf.layer_info.name, layer); + 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.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.clt_port = cport; - conf.srv_port = sport; + 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; - break; - case IPCP_ETH_DIX: - if (dev == NULL) + if (strlen(dev) > DEV_NAME_SIZE) { + printf("Device name too long.\n\n"); goto fail_usage; - conf.dev = dev; - conf.ethertype = ethertype; + } + + strcpy(conf.eth.dev, dev); break; case IPCP_BROADCAST: /* FALLTHRU */ case IPCP_LOCAL: - /* FALLTHRU */ - case IPCP_RAPTOR: break; default: assert(false); diff --git a/src/tools/irm/irm_ipcp_connect.c b/src/tools/irm/irm_ipcp_connect.c index 12541b2c..68e13bd0 100644 --- a/src/tools/irm/irm_ipcp_connect.c +++ b/src/tools/irm/irm_ipcp_connect.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Connect components of unicast or broadcast IPC processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,25 +55,25 @@ static void usage(void) " name <ipcp name>\n" " dst <name of destination IPCP>\n" " [component [COMPONENT]]\n" - "where COMPONENT = {" DT " " MGMT "}\n\n" + "where COMPONENT in {" DT " " MGMT "}\n\n" "if COMPONENT == " DT "\n" " [qos [QOS]\n" - "where QOS = {raw, best, voice, video, data}\n\n"); + "where QOS in {raw, best, voice, video, data}\n"); } int do_connect_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - char * dst = NULL; - char * comp = "*"; - char * component = NULL; - char * qos = NULL; - struct ipcp_info * ipcps; - ssize_t len = 0; - pid_t pid = -1; - ssize_t i; - qosspec_t qs = qos_raw; + char * ipcp = NULL; + char * dst = NULL; + char * comp = "*"; + char * component = NULL; + char * qos = NULL; + struct ipcp_list_info * ipcps; + ssize_t len = 0; + pid_t pid = -1; + ssize_t i; + qosspec_t qs = qos_raw; while (argc > 0) { if (matches(*argv, "name") == 0) { diff --git a/src/tools/irm/irm_ipcp_create.c b/src/tools/irm/irm_ipcp_create.c index ae2c2289..35d33782 100644 --- a/src/tools/irm/irm_ipcp_create.c +++ b/src/tools/irm/irm_ipcp_create.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Create IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -44,30 +44,29 @@ #include "irm_ops.h" #include "irm_utils.h" -#define UNICAST "unicast" +#define UNICAST "unicast" #define BROADCAST "broadcast" #define UDP "udp" #define ETH_LLC "eth-llc" #define ETH_DIX "eth-dix" #define LOCAL "local" -#define RAPTOR "raptor" static void usage(void) { printf("Usage: irm ipcp create\n" " name <ipcp name>\n" " type [TYPE]\n\n" - "where TYPE = {" UNICAST " " BROADCAST " " LOCAL " " - UDP " " ETH_LLC " " RAPTOR "}\n"); + "where TYPE in {" UNICAST " " BROADCAST " " LOCAL " " + UDP " " ETH_LLC " " ETH_DIX "}\n"); } int do_create_ipcp(int argc, char ** argv) { - char * ipcp_type = NULL; - char * ipcp_name = NULL; - enum ipcp_type type = 0; - pid_t pid; + char * ipcp_type = NULL; + char * ipcp_name = NULL; + enum ipcp_type type = 0; + pid_t pid; while (argc > 0) { if (matches(*argv, "type") == 0) { @@ -101,15 +100,14 @@ int do_create_ipcp(int argc, type = IPCP_ETH_LLC; else if (strcmp(ipcp_type, ETH_DIX) == 0) type = IPCP_ETH_DIX; - else if (strcmp(ipcp_type, RAPTOR) == 0) - type = IPCP_RAPTOR; else { + printf("IPCP type \"%s\" is unknown.\n", ipcp_type); usage(); return -1; } pid = irm_create_ipcp(ipcp_name, type); - if (pid <= 0) + if (pid < 0) return -1; return 0; diff --git a/src/tools/irm/irm_ipcp_destroy.c b/src/tools/irm/irm_ipcp_destroy.c index be03df00..1a5e564e 100644 --- a/src/tools/irm/irm_ipcp_destroy.c +++ b/src/tools/irm/irm_ipcp_destroy.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Destroy IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,10 +55,10 @@ static void usage(void) int do_destroy_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - struct ipcp_info * ipcps; - ssize_t len; - int i; + char * ipcp = NULL; + struct ipcp_list_info * ipcps; + ssize_t len; + int i; while (argc > 0) { if (matches(*argv, "name") == 0) { diff --git a/src/tools/irm/irm_ipcp_disconnect.c b/src/tools/irm/irm_ipcp_disconnect.c index d92d56eb..7ce724e1 100644 --- a/src/tools/irm/irm_ipcp_disconnect.c +++ b/src/tools/irm/irm_ipcp_disconnect.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Connect components of unicast or broadcast IPC processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,20 +54,20 @@ static void usage(void) " name <ipcp name>\n" " dst <name of destination IPCP>\n" " [component [COMPONENT]]\n\n" - "where COMPONENT = {" DT " " MGMT "}\n"); + "where COMPONENT in {" DT " " MGMT "}\n"); } int do_disconnect_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - char * dst = NULL; - char * comp = "*"; - char * component = NULL; - struct ipcp_info * ipcps; - ssize_t len = 0; - pid_t pid = -1; - ssize_t i; + char * ipcp = NULL; + char * dst = NULL; + char * comp = "*"; + char * component = NULL; + struct ipcp_list_info * ipcps; + ssize_t len = 0; + pid_t pid = -1; + ssize_t i; while (argc > 0) { if (matches(*argv, "name") == 0) { diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c index ebb1da43..86a22a71 100644 --- a/src/tools/irm/irm_ipcp_enroll.c +++ b/src/tools/irm/irm_ipcp_enroll.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Enroll IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,15 +57,15 @@ static void usage(void) " [dst <destination to enroll with>]\n" " [type [TYPE], default = " UNICAST "]\n" " [autobind]\n" - "where TYPE = {" UNICAST " " BROADCAST "}\n"); + "where TYPE in {" UNICAST " " BROADCAST "}\n"); } static int get_layer_name(const char * ipcp, char * layer_name) { - struct ipcp_info * ipcps; - size_t len; - size_t i; + struct ipcp_list_info * ipcps; + ssize_t len; + ssize_t i; len = irm_list_ipcps(&ipcps); for (i = 0; i < len; i++) @@ -83,17 +83,17 @@ static int get_layer_name(const char * ipcp, int do_enroll_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - char * layer = NULL; - char * dst = NULL; - struct ipcp_info * ipcps; - pid_t pid = -1; - ssize_t len = 0; - int i = 0; - bool autobind = false; - int cargs; - char * ipcp_type = UNICAST; - enum ipcp_type type = IPCP_INVALID; + char * ipcp = NULL; + char * layer = NULL; + char * dst = NULL; + struct ipcp_list_info * ipcps; + pid_t pid = -1; + ssize_t len = 0; + int i = 0; + bool autobind = false; + int cargs; + char * ipcp_type = UNICAST; + enum ipcp_type type = IPCP_INVALID; while (argc > 0) { cargs = 2; @@ -146,40 +146,39 @@ int do_enroll_ipcp(int argc, } for (i = 0; i < len; i++) { + char enr_layer[LAYER_NAME_SIZE]; if (ipcps[i].type != type) continue; - if (wildcard_match(ipcps[i].name, ipcp) == 0) { - char enr_layer[LAYER_NAME_SIZE]; + if (wildcard_match(ipcps[i].name, ipcp) != 0) + continue; - pid = ipcps[i].pid; + pid = ipcps[i].pid; + + if (irm_enroll_ipcp(pid, dst)) { + printf("Failed to enroll IPCP.\n"); + goto fail; + } + + if (get_layer_name(ipcps[i].name, enr_layer)) { + printf("Could not get layer name.\n"); + goto fail; + } - if (irm_enroll_ipcp(pid, dst)) { - printf("Failed to enroll IPCP.\n"); - goto fail; - } - - if (get_layer_name(ipcps[i].name, enr_layer)) { - printf("Could not get layer name.\n"); - goto fail; - } - - if (layer != NULL && strcmp(enr_layer, layer)) { - printf("Enrollment destination does not " - "match requested layer.\n"); - goto fail; - } - - if (autobind && irm_bind_process(pid, ipcp)) { - printf("Failed to bind %d to %s.\n", pid, ipcp); - goto fail; - } - - if (autobind && irm_bind_process(pid, enr_layer)) { - printf("Failed to bind %d to %s.\n", - pid, enr_layer); - goto fail; - } + if (layer != NULL && strcmp(enr_layer, layer)) { + printf("Enrollment destination does not " + "match requested layer.\n"); + goto fail; + } + + if (autobind && irm_bind_process(pid, ipcp)) { + printf("Failed to bind %d to %s.\n", pid, ipcp); + goto fail; + } + + if (autobind && irm_bind_process(pid, enr_layer)) { + printf("Failed to bind %d to %s.\n", pid, enr_layer); + goto fail; } } diff --git a/src/tools/irm/irm_ipcp_list.c b/src/tools/irm/irm_ipcp_list.c index 3b8612ed..dfa3099f 100644 --- a/src/tools/irm/irm_ipcp_list.c +++ b/src/tools/irm/irm_ipcp_list.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * List IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,12 +46,12 @@ #include <stdlib.h> #include <string.h> -#define UNICAST "unicast" -#define UDP "udp" -#define ETH_LLC "eth-llc" -#define ETH_DIX "eth-dix" -#define LOCAL "local" -#define RAPTOR "raptor" +#define UNICAST "unicast" +#define BROADCAST "broadcast" +#define UDP "udp" +#define ETH_LLC "eth-llc" +#define ETH_DIX "eth-dix" +#define LOCAL "local" static void usage(void) { @@ -60,7 +60,7 @@ static void usage(void) " [layer <layer_name>]\n\n" " [type [TYPE]]\n\n" "where TYPE = {" UNICAST " " LOCAL " " - UDP " " ETH_LLC " " ETH_DIX " " RAPTOR "}\n"); + UDP " " ETH_LLC " " ETH_DIX "}\n"); } static char * str_type(enum ipcp_type type) @@ -68,14 +68,14 @@ static char * str_type(enum ipcp_type type) switch(type) { case IPCP_UNICAST: return UNICAST; + case IPCP_BROADCAST: + return BROADCAST; case IPCP_ETH_LLC: return ETH_LLC; case IPCP_ETH_DIX: return ETH_DIX; case IPCP_UDP: return UDP; - case IPCP_RAPTOR: - return RAPTOR; case IPCP_LOCAL: return LOCAL; default: @@ -86,12 +86,12 @@ static char * str_type(enum ipcp_type type) int do_list_ipcp(int argc, char ** argv) { - char * ipcp_type = NULL; - char * ipcp_name = NULL; - enum ipcp_type type = -1; - struct ipcp_info * ipcps; - ssize_t len; - ssize_t i; + char * ipcp_type = NULL; + char * ipcp_name = NULL; + enum ipcp_type type = -1; + struct ipcp_list_info * ipcps; + ssize_t len; + ssize_t i; while (argc > 0) { if (matches(*argv, "type") == 0) { @@ -111,6 +111,8 @@ int do_list_ipcp(int argc, if (ipcp_type != NULL) { if (strcmp(ipcp_type, UNICAST) == 0) type = IPCP_UNICAST; + else if (strcmp(ipcp_type, BROADCAST) == 0) + type = IPCP_BROADCAST; else if (strcmp(ipcp_type, UDP) == 0) type = IPCP_UDP; else if (strcmp(ipcp_type, LOCAL) == 0) @@ -119,8 +121,6 @@ int do_list_ipcp(int argc, type = IPCP_ETH_LLC; else if (strcmp(ipcp_type, ETH_DIX) == 0) type = IPCP_ETH_DIX; - else if (strcmp(ipcp_type, RAPTOR) == 0) - type = IPCP_RAPTOR; else { usage(); return -1; diff --git a/src/tools/irm/irm_name.c b/src/tools/irm/irm_name.c index 3a615b00..d60b6c78 100644 --- a/src/tools/irm/irm_name.c +++ b/src/tools/irm/irm_name.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * A tool to instruct the IRM daemon * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -44,9 +44,10 @@ static void usage(void) { printf("Usage: irm name [OPERATION]\n\n" - "where OPERATION = {create destroy\n" - " register unregister\n" - " list help}\n"); + "where OPERATION in {create destroy\n" + " register unregister\n" + " list\n" + " help}\n"); } static int do_help(int argc, char **argv) diff --git a/src/tools/irm/irm_name_create.c b/src/tools/irm/irm_name_create.c index 9b7e6a36..a0079cad 100644 --- a/src/tools/irm/irm_name_create.c +++ b/src/tools/irm/irm_name_create.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Create IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -52,7 +52,7 @@ static void usage(void) printf("Usage: irm name create\n" " <name>\n" " lb [LB_POLICY], default: %s\n\n" - "where LB_POLICY = {" RR " " SPILL "}\n", RR); + "where LB_POLICY in {" RR " " SPILL "}\n", RR); } int do_create_name(int argc, diff --git a/src/tools/irm/irm_name_destroy.c b/src/tools/irm/irm_name_destroy.c index 70f801b2..d4bd6c82 100644 --- a/src/tools/irm/irm_name_destroy.c +++ b/src/tools/irm/irm_name_destroy.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Create IPC Processes * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_name_list.c b/src/tools/irm/irm_name_list.c index 2e4c3194..a807008c 100644 --- a/src/tools/irm/irm_name_list.c +++ b/src/tools/irm/irm_name_list.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * List names * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_name_reg.c b/src/tools/irm/irm_name_reg.c index 52bf911b..061ed8be 100644 --- a/src/tools/irm/irm_name_reg.c +++ b/src/tools/irm/irm_name_reg.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Register names with IPCPs * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,17 +64,17 @@ static void usage(void) int do_reg_name(int argc, char ** argv) { - char * name = NULL; - char * layers[MAX_LAYERS]; - size_t layers_len = 0; - char * ipcp[MAX_IPCPS]; - size_t ipcp_len = 0; - struct ipcp_info * ipcps; - ssize_t ipcps_len; - struct name_info * names; - ssize_t names_len; - bool name_create = true; - ssize_t i; + char * name = NULL; + char * layers[MAX_LAYERS]; + size_t layers_len = 0; + char * ipcp[MAX_IPCPS]; + size_t ipcp_len = 0; + struct ipcp_list_info * ipcps; + ssize_t ipcps_len; + struct name_info * names; + ssize_t names_len; + bool name_create = true; + ssize_t i; name = *(argv++); --argc; diff --git a/src/tools/irm/irm_name_unreg.c b/src/tools/irm/irm_name_unreg.c index 48253143..6e579f04 100644 --- a/src/tools/irm/irm_name_unreg.c +++ b/src/tools/irm/irm_name_unreg.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Unregister names from IPCPs * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,14 +63,14 @@ static void usage(void) int do_unreg_name(int argc, char ** argv) { - char * name = NULL; - char * layers[MAX_LAYERS]; - size_t layers_len = 0; - char * ipcp[MAX_IPCPS]; - size_t ipcp_len = 0; - struct ipcp_info * ipcps; - ssize_t len; - size_t i; + char * name = NULL; + char * layers[MAX_LAYERS]; + size_t layers_len = 0; + char * ipcp[MAX_IPCPS]; + size_t ipcp_len = 0; + struct ipcp_list_info * ipcps; + ssize_t len; + size_t i; name = *(argv++); --argc; diff --git a/src/tools/irm/irm_ops.h b/src/tools/irm/irm_ops.h index 7c1b1a8f..e04ffc02 100644 --- a/src/tools/irm/irm_ops.h +++ b/src/tools/irm/irm_ops.h @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Functions of the IRM tool that are one level deep * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c index 05838235..d6594d01 100644 --- a/src/tools/irm/irm_unbind.c +++ b/src/tools/irm/irm_unbind.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Unbind names in the processing system * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,7 +47,7 @@ static void usage(void) { printf("Usage: irm unbind [OPERATION]\n" "\n" - "where OPERATION = {program process ipcp help}\n"); + "where OPERATION in {program process ipcp help}\n"); } static int do_help(int argc, diff --git a/src/tools/irm/irm_unbind_ipcp.c b/src/tools/irm/irm_unbind_ipcp.c index d121b2dc..53a2d16c 100644 --- a/src/tools/irm/irm_unbind_ipcp.c +++ b/src/tools/irm/irm_unbind_ipcp.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Unbind name from IPCP Instance * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,11 +57,11 @@ static void usage(void) int do_unbind_ipcp(int argc, char ** argv) { - char * ipcp = NULL; - char * name = NULL; - struct ipcp_info * ipcps; - ssize_t len; - ssize_t i; + char * ipcp = NULL; + char * name = NULL; + struct ipcp_list_info * ipcps; + ssize_t len; + ssize_t i; while (argc > 0) { if (matches(*argv, "name") == 0) { diff --git a/src/tools/irm/irm_unbind_process.c b/src/tools/irm/irm_unbind_process.c index d5b96141..264ed538 100644 --- a/src/tools/irm/irm_unbind_process.c +++ b/src/tools/irm/irm_unbind_process.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Unbind process names * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_unbind_program.c b/src/tools/irm/irm_unbind_program.c index 382c5d8a..0c751e80 100644 --- a/src/tools/irm/irm_unbind_program.c +++ b/src/tools/irm/irm_unbind_program.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Unbind programs * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c index 0620e374..9694d647 100644 --- a/src/tools/irm/irm_utils.c +++ b/src/tools/irm/irm_utils.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Handy helper functions for the IRM tool * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -109,7 +109,7 @@ int wildcard_match(const char * pattern, return 0; /* General case, use recursion. */ - while ((c = *string) != '\0') { + while (*string != '\0') { if (!wildcard_match(pattern, string)) return 0; ++string; diff --git a/src/tools/irm/irm_utils.h b/src/tools/irm/irm_utils.h index 925a9da6..27a0b941 100644 --- a/src/tools/irm/irm_utils.h +++ b/src/tools/irm/irm_utils.h @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * Handy helper functions for the IRM tool * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |