summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-03-16 15:16:21 +0100
committerSander Vrijders <sander@ouroboros.rocks>2019-03-18 11:09:31 +0100
commit8940fe2cc063d2de8393684ff48efec0e27edc8a (patch)
tree934574e25a84f9a486004e7fc30cc35430cc44bf /src/tools
parent7702cb0f44f4cbb31436b2d2c621d4e5b4c0edec (diff)
downloadouroboros-8940fe2cc063d2de8393684ff48efec0e27edc8a.tar.gz
ouroboros-8940fe2cc063d2de8393684ff48efec0e27edc8a.zip
ipcpd: Revise UDP IPCP
The UDP IPCP now uses a fixed server UDP port (default 3435) for all communications. This allows passing firewalls more easily since only a single port needs to be opened. The client port can be fixed as well if needed (default random). It uses an internal eid, so the MTU of the UDP layer is reduced by 4 bytes, similar to the Ethernet IPCPs. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index 259b4325..7134bf64 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -73,6 +73,8 @@
#define DEFAULT_PFF PFF_SIMPLE
#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 FLAT_RANDOM_ADDR_AUTH "flat"
#define LINK_STATE_ROUTING "link_state"
@@ -106,6 +108,8 @@ static void usage(void)
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"
" [dns <DDNS IP address in dotted notation>"
" (default: none)]\n\n"
"if TYPE == " ETH_LLC "\n"
@@ -126,12 +130,13 @@ static void usage(void)
"if TYPE == " RAPTOR "\n"
" [hash [ALGORITHM] (default: %s)]\n"
"where ALGORITHM = {" SHA3_224 " " SHA3_256 " "
- SHA3_384 " " SHA3_512 "}\n"
+ 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, SIMPLE_PFF,
- SHA3_256, SHA3_256, 0xA000, SHA3_256, SHA3_256, SHA3_256);
+ SHA3_256, DEFAULT_SERVER_PORT, SHA3_256, 0xA000, SHA3_256,
+ SHA3_256, SHA3_256);
}
int do_bootstrap_ipcp(int argc,
@@ -159,6 +164,8 @@ int do_bootstrap_ipcp(int argc,
int i = 0;
bool autobind = false;
int cargs;
+ int cport = DEFAULT_CLIENT_PORT;
+ int sport = DEFAULT_SERVER_PORT;
while (argc > 0) {
cargs = 2;
@@ -205,6 +212,10 @@ 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, "autobind") == 0) {
autobind = true;
cargs = 1;
@@ -318,8 +329,10 @@ int do_bootstrap_ipcp(int argc,
case IPCP_UDP:
if (ip_addr == 0)
goto fail_usage;
- conf.ip_addr = ip_addr;
+ conf.ip_addr = ip_addr;
conf.dns_addr = dns_addr;
+ conf.clt_port = cport;
+ conf.srv_port = sport;
break;
case IPCP_ETH_LLC:
if (dev == NULL)