diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-07 17:58:36 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-07 17:58:36 +0100 |
commit | c3b77fea0f652b7d8f0641696f3a3418864ab135 (patch) | |
tree | 57a0320fe248583863e98938d2e5bea4e7b6f68f /src/transport/plugin_transport_udp.c | |
parent | ddadc570d8fd3ce7a4f658adf9a2c9b9d9c0dcba (diff) | |
download | gnunet-c3b77fea0f652b7d8f0641696f3a3418864ab135.tar.gz gnunet-c3b77fea0f652b7d8f0641696f3a3418864ab135.zip |
fix calls to test_address, expects a struct sockaddr, not an in_addr
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index c9fb754c1..8281e48c5 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1245,31 +1245,48 @@ udp_plugin_check_address (void *cls, | |||
1245 | 1245 | ||
1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) | 1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) |
1247 | { | 1247 | { |
1248 | struct sockaddr_in s4; | ||
1249 | |||
1248 | v4 = (const struct IPv4UdpAddress *) addr; | 1250 | v4 = (const struct IPv4UdpAddress *) addr; |
1249 | if (GNUNET_OK != check_port (plugin, | 1251 | if (GNUNET_OK != check_port (plugin, |
1250 | ntohs (v4->u4_port))) | 1252 | ntohs (v4->u4_port))) |
1251 | return GNUNET_SYSERR; | 1253 | return GNUNET_SYSERR; |
1254 | memset (&s4, 0, sizeof (s4)); | ||
1255 | s4.sin_family = AF_INET; | ||
1256 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1257 | s4.sin_len = sizeof (s4); | ||
1258 | #endif | ||
1259 | s4.sin_port = v4->u4_port; | ||
1260 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
1261 | |||
1252 | if (GNUNET_OK != | 1262 | if (GNUNET_OK != |
1253 | GNUNET_NAT_test_address (plugin->nat, | 1263 | GNUNET_NAT_test_address (plugin->nat, |
1254 | &v4->ipv4_addr, | 1264 | &s4, |
1255 | sizeof (struct in_addr))) | 1265 | sizeof (struct sockaddr_in))) |
1256 | return GNUNET_SYSERR; | 1266 | return GNUNET_SYSERR; |
1257 | } | 1267 | } |
1258 | else if (sizeof(struct IPv6UdpAddress) == addrlen) | 1268 | else if (sizeof(struct IPv6UdpAddress) == addrlen) |
1259 | { | 1269 | { |
1270 | struct sockaddr_in6 s6; | ||
1271 | |||
1260 | v6 = (const struct IPv6UdpAddress *) addr; | 1272 | v6 = (const struct IPv6UdpAddress *) addr; |
1261 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 1273 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
1262 | { | 1274 | { |
1263 | GNUNET_break_op (0); | 1275 | GNUNET_break_op (0); |
1264 | return GNUNET_SYSERR; | 1276 | return GNUNET_SYSERR; |
1265 | } | 1277 | } |
1266 | if (GNUNET_OK != check_port (plugin, | 1278 | memset (&s6, 0, sizeof (s6)); |
1267 | ntohs (v6->u6_port))) | 1279 | s6.sin6_family = AF_INET6; |
1268 | return GNUNET_SYSERR; | 1280 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1281 | s6.sin6_len = sizeof (s6); | ||
1282 | #endif | ||
1283 | s6.sin6_port = v6->u6_port; | ||
1284 | s6.sin6_addr = v6->ipv6_addr; | ||
1285 | |||
1269 | if (GNUNET_OK != | 1286 | if (GNUNET_OK != |
1270 | GNUNET_NAT_test_address (plugin->nat, | 1287 | GNUNET_NAT_test_address (plugin->nat, |
1271 | &v6->ipv6_addr, | 1288 | &s6, |
1272 | sizeof (struct in6_addr))) | 1289 | sizeof(struct sockaddr_in6))) |
1273 | return GNUNET_SYSERR; | 1290 | return GNUNET_SYSERR; |
1274 | } | 1291 | } |
1275 | else | 1292 | else |