diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-04-27 19:05:07 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-04-27 19:05:07 +0200 |
commit | d697babdbe0671b5d9a4cf4e0e46234f5045faef (patch) | |
tree | 02f9df75cdb4142a843d04c8727e917c77c20f7d /src/ipcpd | |
parent | 711789580dc6ee3a1a22b8fee63f5eff7e7dbb5e (diff) | |
parent | 1a02682d0695509bb8255b2d10dee48c61d83c34 (diff) | |
download | ouroboros-d697babdbe0671b5d9a4cf4e0e46234f5045faef.tar.gz ouroboros-d697babdbe0671b5d9a4cf4e0e46234f5045faef.zip |
Merged in dstaesse/ouroboros/udp-flow-alloc (pull request #63)
lib: client-side flow allocation
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/ipcp.h | 3 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index f640d78b..9decac8b 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -26,9 +26,6 @@ #include "ipcp-ops.h" #include "ipcp-data.h" -/* needed to run over shim DIFs */ -#define ANONYMOUS_AP "__ANONYMOUS__" - enum ipcp_state { IPCP_INIT = 0, IPCP_ENROLLING, diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index c07d77c2..71c414ef 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -29,6 +29,7 @@ #include <ouroboros/ipcp.h> #include <ouroboros/dif_config.h> #include <ouroboros/sockets.h> +#include <ouroboros/dev.h> #define OUROBOROS_PREFIX "ipcpd/shim-udp" @@ -192,7 +193,7 @@ static void * ipcp_udp_listener() /* reply to IRM */ flow->flow.port_id = ipcp_flow_req_arr(getpid(), buf, - ANONYMOUS_AP, ""); + UNKNOWN_AP, ""); if (flow->flow.port_id < 0) { LOG_ERR("Could not get port id from IRMd"); close(flow->fd); @@ -270,6 +271,7 @@ int ipcp_udp_bootstrap(struct dif_config * conf) char dnsstr[INET_ADDRSTRLEN]; pthread_t handler; pthread_t sdu_reader; + int enable = 1; if (conf->type != THIS_TYPE) { LOG_ERR("Config doesn't match IPCP type."); @@ -305,6 +307,14 @@ int ipcp_udp_bootstrap(struct dif_config * conf) return -1; } + if (setsockopt(shim_data(_ipcp)->s_fd, + SOL_SOCKET, + SO_REUSEADDR, + &enable, + sizeof(int)) < 0) { + LOG_DBGF("Setsockopt(SO_REUSEADDR) failed."); + } + shim_data(_ipcp)->s_saddr.sin_family = AF_INET; shim_data(_ipcp)->s_saddr.sin_addr.s_addr = conf->ip_addr; shim_data(_ipcp)->s_saddr.sin_port = LISTEN_PORT; @@ -419,6 +429,7 @@ int ipcp_udp_flow_alloc(uint32_t port_id, h = gethostbyname(dst_name); if (h == NULL) { + LOG_DBGF("Could not resolve %s.", dst_name); close(flow->fd); free(flow); return -1; |