From 1a02682d0695509bb8255b2d10dee48c61d83c34 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 27 Apr 2016 18:36:31 +0200 Subject: lib: client-side flow allocation flow allocation now propagates on the client side up to the IPCP. added UNKNOWN_AP and UNKNOWN_AE definitions to dev.h --- src/ipcpd/ipcp.h | 3 --- src/ipcpd/shim-udp/main.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/ipcpd') 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 #include #include +#include #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; -- cgit v1.2.3