diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2025-08-17 12:09:12 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-09-10 08:19:52 +0200 |
commit | 5274cb3ce09c40cccd29ec771ad49a2069aa37c4 (patch) | |
tree | 634d94ede018b6c108a85e30e5f29f1725bf6100 /include | |
parent | f2a6a1c302a5e962c61857ed4a2f03bd5991b41c (diff) | |
download | ouroboros-5274cb3ce09c40cccd29ec771ad49a2069aa37c4.tar.gz ouroboros-5274cb3ce09c40cccd29ec771ad49a2069aa37c4.zip |
ipcpd: Add ipcpd over UDP/IPv6
This adds an IPCP that runs over UDP/IPv6. It's structured like the
eth-dix and eth-llc in that it builds two separate binaries:
ipcpd-udp4 and ipcpd-udp6. The IRM CLI is backwards compatible in that
type 'udp' will resolve to type 'udp4'.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/ipcp.h | 38 | ||||
-rw-r--r-- | include/ouroboros/protobuf.h | 11 |
2 files changed, 35 insertions, 14 deletions
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index 26fcdec4..c397f250 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -26,6 +26,7 @@ #include <stdint.h> #include <unistd.h> #include <stdbool.h> +#include <netinet/in.h> #include <sys/types.h> #define IPCP_NAME_SIZE 255 @@ -49,7 +50,8 @@ enum ipcp_type { /* IRMd uses order to select an IPCP for flow allocation. */ IPCP_BROADCAST, IPCP_ETH_LLC, IPCP_ETH_DIX, - IPCP_UDP, + IPCP_UDP4, + IPCP_UDP6, IPCP_INVALID }; @@ -257,10 +259,16 @@ struct eth_config { uint16_t ethertype; /* DIX only*/ }; -struct udp_config { - uint32_t ip_addr; - uint32_t dns_addr; - uint16_t port; +struct udp4_config { + struct in_addr ip_addr; + struct in_addr dns_addr; + uint16_t port; +}; + +struct udp6_config { + struct in6_addr ip_addr; + struct in6_addr dns_addr; + uint16_t port; }; /* Layers */ @@ -276,9 +284,10 @@ struct ipcp_config { enum ipcp_type type; union { - struct uni_config unicast; - struct udp_config udp; - struct eth_config eth; + struct uni_config unicast; + struct udp4_config udp4; + struct udp6_config udp6; + struct eth_config eth; }; }; @@ -307,9 +316,16 @@ static const struct ipcp_config eth_llc_default_conf = { } }; -static const struct ipcp_config udp_default_conf = { - .type = IPCP_UDP, - .udp = { +static const struct ipcp_config udp4_default_conf = { + .type = IPCP_UDP4, + .udp4 = { + .port = 3435 + } +}; + +static const struct ipcp_config udp6_default_conf = { + .type = IPCP_UDP6, + .udp6 = { .port = 3435 } }; diff --git a/include/ouroboros/protobuf.h b/include/ouroboros/protobuf.h index 6cb24c2f..780d58dc 100644 --- a/include/ouroboros/protobuf.h +++ b/include/ouroboros/protobuf.h @@ -38,7 +38,8 @@ typedef DtConfigMsg dt_config_msg_t; typedef DirConfigMsg dir_config_msg_t; typedef DirDhtConfigMsg dir_dht_config_msg_t; typedef EthConfigMsg eth_config_msg_t; -typedef UdpConfigMsg udp_config_msg_t; +typedef Udp4ConfigMsg udp4_config_msg_t; +typedef Udp6ConfigMsg udp6_config_msg_t; typedef UniConfigMsg uni_config_msg_t; #include "ipcp.pb-c.h" @@ -94,9 +95,13 @@ eth_config_msg_t * eth_config_s_to_msg(const struct eth_config * s); struct eth_config eth_config_msg_to_s(const eth_config_msg_t * msg); -udp_config_msg_t * udp_config_s_to_msg(const struct udp_config * s); +udp4_config_msg_t * udp4_config_s_to_msg(const struct udp4_config * s); -struct udp_config udp_config_msg_to_s(const udp_config_msg_t * msg); +struct udp4_config udp4_config_msg_to_s(const udp4_config_msg_t * msg); + +udp6_config_msg_t * udp6_config_s_to_msg(const struct udp6_config * s); + +struct udp6_config udp6_config_msg_to_s(const udp6_config_msg_t * msg); ipcp_config_msg_t * ipcp_config_s_to_msg(const struct ipcp_config * s); |