diff options
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r-- | src/transport/plugin_transport_http.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 1b5f5ed11..8828e3438 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -1199,11 +1199,42 @@ static int | |||
1199 | http_plugin_address_suggested (void *cls, | 1199 | http_plugin_address_suggested (void *cls, |
1200 | void *addr, size_t addrlen) | 1200 | void *addr, size_t addrlen) |
1201 | { | 1201 | { |
1202 | /* struct Plugin *plugin = cls; */ | 1202 | struct IPv4HttpAddress *v4; |
1203 | struct IPv6HttpAddress *v6; | ||
1203 | 1204 | ||
1204 | /* check if the address is plausible; if so, | 1205 | if ((addrlen != sizeof (struct IPv4HttpAddress)) && |
1205 | add it to our list! */ | 1206 | (addrlen != sizeof (struct IPv6HttpAddress))) |
1206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Plugin: http_plugin_address_suggested\n"); | 1207 | { |
1208 | GNUNET_break_op (0); | ||
1209 | return GNUNET_SYSERR; | ||
1210 | } | ||
1211 | if (addrlen == sizeof (struct IPv4HttpAddress)) | ||
1212 | { | ||
1213 | v4 = (struct IPv4HttpAddress *) addr; | ||
1214 | |||
1215 | v4->u_port = ntohs (v4->u_port); | ||
1216 | if (v4->u_port != plugin->port_inbound) | ||
1217 | { | ||
1218 | GNUNET_break_op (0); | ||
1219 | return GNUNET_SYSERR; | ||
1220 | } | ||
1221 | } | ||
1222 | else | ||
1223 | { | ||
1224 | v6 = (struct IPv6HttpAddress *) addr; | ||
1225 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | ||
1226 | { | ||
1227 | GNUNET_break_op (0); | ||
1228 | return GNUNET_SYSERR; | ||
1229 | } | ||
1230 | v6->u6_port = ntohs (v6->u6_port); | ||
1231 | if (v6->u6_port != plugin->port_inbound) | ||
1232 | { | ||
1233 | GNUNET_break_op (0); | ||
1234 | return GNUNET_SYSERR; | ||
1235 | } | ||
1236 | |||
1237 | } | ||
1207 | return GNUNET_OK; | 1238 | return GNUNET_OK; |
1208 | } | 1239 | } |
1209 | 1240 | ||