From 5274cb3ce09c40cccd29ec771ad49a2069aa37c4 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 17 Aug 2025 12:09:12 +0200 Subject: 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 Signed-off-by: Sander Vrijders --- include/ouroboros/ipcp.h | 38 +++++++++++++++++++++++++++----------- include/ouroboros/protobuf.h | 11 ++++++++--- 2 files changed, 35 insertions(+), 14 deletions(-) (limited to 'include') 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 #include #include +#include #include #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); -- cgit v1.2.3