summaryrefslogtreecommitdiff
path: root/src/tools/irm
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-10-31 19:47:45 +0100
committerSander Vrijders <[email protected]>2016-11-01 09:38:20 +0100
commit2d88fdaaa018d607eca5ce057dfbdf41beb6125b (patch)
treef5085671663fa6798065d283619b6e8997e0f51b /src/tools/irm
parent72eb9eed1284643db20c45ef82365fa54fd0ef1c (diff)
downloadouroboros-2d88fdaaa018d607eca5ce057dfbdf41beb6125b.tar.gz
ouroboros-2d88fdaaa018d607eca5ce057dfbdf41beb6125b.zip
ipcpd: normal: Add policy for obtaining a flat address
This adds a policy for obtaining a flat address, and thus also the infrastructure for policies in the IPCP. The IPCP should check if the address is available; this is currently not there yet.
Diffstat (limited to 'src/tools/irm')
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index 7d72eb15..65e99765 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -45,6 +45,9 @@
#define DEFAULT_MIN_PDU_SIZE 0
#define DEFAULT_MAX_PDU_SIZE 9000
#define DEFAULT_DDNS 0
+#define DEFAULT_ADDR_AUTH FLAT_RANDOM
+
+#define ADDR_AUTH_FLAT "flat"
static void usage(void)
{
@@ -64,6 +67,7 @@ static void usage(void)
" [chk <add 32-bit checksum in the PCI>]\n"
" [min_pdu <minimum PDU size> (default: %d)]\n"
" [max_pdu <maximum PDU size> (default: %d)]\n"
+ " [addr_auth <address policy> (default: %s)]\n"
"if TYPE == " SHIM_UDP "\n"
" ip <IP address in dotted notation>\n"
" [dns <DDNS IP address in dotted notation>"
@@ -72,7 +76,8 @@ static void usage(void)
" if_name <interface name>\n",
DEFAULT_ADDR_SIZE, DEFAULT_CEP_ID_SIZE,
DEFAULT_PDU_LEN_SIZE, DEFAULT_SEQ_NO_SIZE,
- DEFAULT_MIN_PDU_SIZE, DEFAULT_MAX_PDU_SIZE, DEFAULT_DDNS);
+ DEFAULT_MIN_PDU_SIZE, DEFAULT_MAX_PDU_SIZE,
+ ADDR_AUTH_FLAT, DEFAULT_DDNS);
}
int do_bootstrap_ipcp(int argc, char ** argv)
@@ -88,6 +93,7 @@ int do_bootstrap_ipcp(int argc, char ** argv)
bool has_chk = false;
uint32_t min_pdu_size = DEFAULT_MIN_PDU_SIZE;
uint32_t max_pdu_size = DEFAULT_MAX_PDU_SIZE;
+ enum pol_addr_auth addr_auth_type = DEFAULT_ADDR_AUTH;
uint32_t ip_addr = 0;
uint32_t dns_addr = DEFAULT_DDNS;
char * ipcp_type = NULL;
@@ -136,6 +142,9 @@ int do_bootstrap_ipcp(int argc, char ** argv)
min_pdu_size = atoi(*(argv + 1));
} else if (matches(*argv, "max_pdu") == 0) {
max_pdu_size = atoi(*(argv + 1));
+ } else if (matches(*argv, "addr_auth") == 0) {
+ if (strcmp(ADDR_AUTH_FLAT, *(argv + 1)) == 0)
+ addr_auth_type = FLAT_RANDOM;
} else {
printf("\"%s\" is unknown, try \"irm "
"ipcp bootstrap\".\n", *argv);
@@ -163,6 +172,7 @@ int do_bootstrap_ipcp(int argc, char ** argv)
conf.has_chk = has_chk;
conf.min_pdu_size = min_pdu_size;
conf.max_pdu_size = max_pdu_size;
+ conf.addr_auth_type = addr_auth_type;
} else if (strcmp(ipcp_type, SHIM_UDP) == 0) {
conf.type = IPCP_SHIM_UDP;
if (ip_addr == 0) {