diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-05-16 12:49:06 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-05-16 12:49:06 +0000 |
commit | 480f5966b1e07e53fc07bdc2adc556352b82eec9 (patch) | |
tree | e421fdcc2b9f534210de694dacb712316ceea248 /src/transport | |
parent | 327599c61fcc768fa4ff795fafba5d03ee291533 (diff) | |
download | gnunet-480f5966b1e07e53fc07bdc2adc556352b82eec9.tar.gz gnunet-480f5966b1e07e53fc07bdc2adc556352b82eec9.zip |
bug fix: ipv6 did not check bind address
ipv6 addresses were given to transport service even if service did bind to a specific ipv4 address
other peers could not validate that address
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index feae04d26..daaf02dde 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2165,7 +2165,7 @@ process_interfaces (void *cls, | |||
2165 | void *arg; | 2165 | void *arg; |
2166 | uint16_t args; | 2166 | uint16_t args; |
2167 | void *arg_nat; | 2167 | void *arg_nat; |
2168 | char buf[INET_ADDRSTRLEN]; | 2168 | char buf[INET6_ADDRSTRLEN]; |
2169 | 2169 | ||
2170 | af = addr->sa_family; | 2170 | af = addr->sa_family; |
2171 | arg_nat = NULL; | 2171 | arg_nat = NULL; |
@@ -2183,7 +2183,7 @@ process_interfaces (void *cls, | |||
2183 | #if DEBUG_TCP | 2183 | #if DEBUG_TCP |
2184 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 2184 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
2185 | "tcp", | 2185 | "tcp", |
2186 | "Not notifying transport of address `%s' (redundant)\n", | 2186 | "Not notifying transport of address `%s' (does not match bind address)\n", |
2187 | GNUNET_a2s (addr, addrlen)); | 2187 | GNUNET_a2s (addr, addrlen)); |
2188 | #endif | 2188 | #endif |
2189 | return GNUNET_OK; | 2189 | return GNUNET_OK; |
@@ -2215,6 +2215,25 @@ process_interfaces (void *cls, | |||
2215 | memcpy (&t6.ipv6_addr, | 2215 | memcpy (&t6.ipv6_addr, |
2216 | &((struct sockaddr_in6 *) addr)->sin6_addr, | 2216 | &((struct sockaddr_in6 *) addr)->sin6_addr, |
2217 | sizeof (struct in6_addr)); | 2217 | sizeof (struct in6_addr)); |
2218 | |||
2219 | /* check bind address */ | ||
2220 | GNUNET_assert (NULL != inet_ntop(AF_INET6, | ||
2221 | &t6.ipv6_addr, | ||
2222 | buf, | ||
2223 | sizeof (buf))); | ||
2224 | |||
2225 | if ( (plugin->bind_address != NULL) && | ||
2226 | (0 != strcmp(buf, plugin->bind_address)) ) | ||
2227 | { | ||
2228 | #if DEBUG_TCP | ||
2229 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | ||
2230 | "tcp", | ||
2231 | "Not notifying transport of address `%s' (does not match bind address)\n", | ||
2232 | GNUNET_a2s (addr, addrlen)); | ||
2233 | #endif | ||
2234 | return GNUNET_OK; | ||
2235 | } | ||
2236 | |||
2218 | add_to_address_list (plugin, | 2237 | add_to_address_list (plugin, |
2219 | &t6.ipv6_addr, | 2238 | &t6.ipv6_addr, |
2220 | sizeof (struct in6_addr)); | 2239 | sizeof (struct in6_addr)); |