summaryrefslogtreecommitdiff
path: root/ot_http.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2024-04-03 22:25:30 +0200
committerDirk Engling <erdgeist@erdgeist.org>2024-04-03 22:25:30 +0200
commit2afc4893bf802700a1decfff57673cefc861c7e7 (patch)
tree9a0817371ac05062dbcf25107fcf5a6481feccc0 /ot_http.c
parenteb8834f7783cb85ae825976425800cd4af711263 (diff)
Prepare opentracker for dual stack capabilities
Diffstat (limited to 'ot_http.c')
-rw-r--r--ot_http.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/ot_http.c b/ot_http.c
index 88b4261..374d6d8 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -421,26 +421,18 @@ static ssize_t http_handle_announce( const int64 sock, struct ot_workstruct *ws,
421 ot_ip6 proxied_ip; 421 ot_ip6 proxied_ip;
422 char *fwd = http_header( ws->request, ws->header_size, "x-forwarded-for" ); 422 char *fwd = http_header( ws->request, ws->header_size, "x-forwarded-for" );
423 if( fwd && scan_ip6( fwd, proxied_ip ) ) { 423 if( fwd && scan_ip6( fwd, proxied_ip ) ) {
424 /* If proxy reports an ipv6 address but we can only handle v4 (or vice versa), bail out */ 424 OT_SETIP( ws->peer, proxied_ip );
425#ifndef WANT_V6
426 if( !ip6_isv4mapped(proxied_ip) )
427#else
428 if( ip6_isv4mapped(proxied_ip) )
429#endif
430 HTTPERROR_400_PARAM;
431
432 OT_SETIP( &ws->peer, proxied_ip );
433 } else 425 } else
434 OT_SETIP( &ws->peer, cookie->ip ); 426 OT_SETIP( ws->peer, cookie->ip );
435 } else 427 } else
436#endif 428#endif
437 OT_SETIP( &ws->peer, cookie->ip ); 429 OT_SETIP( ws->peer, cookie->ip );
438 430
439 ws->peer_id = NULL; 431 ws->peer_id = NULL;
440 ws->hash = NULL; 432 ws->hash = NULL;
441 433
442 OT_SETPORT( &ws->peer, &port ); 434 OT_SETPORT( ws->peer, &port );
443 OT_PEERFLAG( &ws->peer ) = 0; 435 OT_PEERFLAG( ws->peer ) = 0;
444 numwant = 50; 436 numwant = 50;
445 scanon = 1; 437 scanon = 1;
446 438