From 2d88fdaaa018d607eca5ce057dfbdf41beb6125b Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 31 Oct 2016 19:47:45 +0100 Subject: 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. --- src/tools/irm/irm_ipcp_bootstrap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/tools/irm/irm_ipcp_bootstrap.c') 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 ]\n" " [min_pdu (default: %d)]\n" " [max_pdu (default: %d)]\n" + " [addr_auth
(default: %s)]\n" "if TYPE == " SHIM_UDP "\n" " ip \n" " [dns " @@ -72,7 +76,8 @@ static void usage(void) " if_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) { -- cgit v1.2.3