diff options
author | Dimitri Staessens <[email protected]> | 2019-03-16 15:16:21 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2019-03-18 11:09:31 +0100 |
commit | 8940fe2cc063d2de8393684ff48efec0e27edc8a (patch) | |
tree | 934574e25a84f9a486004e7fc30cc35430cc44bf /src/ipcpd/ipcp.c | |
parent | 7702cb0f44f4cbb31436b2d2c621d4e5b4c0edec (diff) | |
download | ouroboros-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 <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r-- | src/ipcpd/ipcp.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 8e0cd189..bd0aeee5 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -231,37 +231,39 @@ static void * mainloop(void * o) conf.type = conf_msg->ipcp_type; strcpy(conf.layer_info.layer_name, conf_msg->layer_info->layer_name); - if (conf_msg->ipcp_type == IPCP_NORMAL) { + + switch(conf_msg->ipcp_type) { + case IPCP_NORMAL: conf.addr_size = conf_msg->addr_size; conf.eid_size = conf_msg->eid_size; conf.max_ttl = conf_msg->max_ttl; conf.addr_auth_type = conf_msg->addr_auth_type; conf.routing_type = conf_msg->routing_type; conf.pff_type = conf_msg->pff_type; - } - - if (conf_msg->ipcp_type == IPCP_ETH_LLC) - conf.dev = conf_msg->dev; - - if (conf_msg->ipcp_type == IPCP_ETH_DIX) { - conf.dev = conf_msg->dev; + break; + case IPCP_ETH_DIX: conf.ethertype = conf_msg->ethertype; - } - - if (conf_msg->ipcp_type == IPCP_UDP) { + /* FALLTHRU */ + case IPCP_ETH_LLC: + conf.dev = conf_msg->dev; + break; + case IPCP_UDP: conf.ip_addr = conf_msg->ip_addr; conf.dns_addr = conf_msg->dns_addr; - + conf.clt_port = conf_msg->clt_port; + conf.srv_port = conf_msg->srv_port; conf.layer_info.dir_hash_algo = HASH_MD5; layer_info.dir_hash_algo = HASH_MD5; - } - - if (conf_msg->ipcp_type == IPCP_BROADCAST) { + break; + case IPCP_BROADCAST: conf.layer_info.dir_hash_algo = HASH_SHA3_256; layer_info.dir_hash_algo = HASH_SHA3_256; + break; + default: + log_err("Unknown IPCP type."); } - /* UDP and broadcast have a fixed hash algorithm. */ + /* UDP and broadcast use fixed hash algorithm. */ if (conf_msg->ipcp_type != IPCP_UDP && conf_msg->ipcp_type != IPCP_BROADCAST) { switch(conf_msg->layer_info->dir_hash_algo) { |