From: Guus Sliepen Date: Fri, 15 May 2015 21:01:06 +0000 (+0200) Subject: Use AF_UNSPEC instead of AF_UNKNOWN for unspecified local address in add_edge_h(). X-Git-Tag: release-1.1pre12~162 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=8028e01100eb40f64da5e50ef33fbf9e3f8099de;p=tinc Use AF_UNSPEC instead of AF_UNKNOWN for unspecified local address in add_edge_h(). AF_UNKNOWN is reserved for valid addresses that the local node cannot parse, but remote nodes possibly can. --- diff --git a/src/protocol_edge.c b/src/protocol_edge.c index 4760162c..43e32364 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -61,9 +61,9 @@ bool add_edge_h(connection_t *c, const char *request) { char to_name[MAX_STRING_SIZE]; char to_address[MAX_STRING_SIZE]; char to_port[MAX_STRING_SIZE]; - char address_local[MAX_STRING_SIZE] = "unknown"; - char port_local[MAX_STRING_SIZE] = "unknown"; - sockaddr_t address, local_address; + char address_local[MAX_STRING_SIZE]; + char port_local[MAX_STRING_SIZE]; + sockaddr_t address, local_address = {{0}}; uint32_t options; int weight; @@ -117,7 +117,8 @@ bool add_edge_h(connection_t *c, const char *request) { /* Convert addresses */ address = str2sockaddr(to_address, to_port); - local_address = str2sockaddr(address_local, port_local); + if(parameter_count >= 8) + local_address = str2sockaddr(address_local, port_local); /* Check if edge already exists */