Browse Source

Fix debug output for addresses >127

dynamic-accesslists
erdgeist 16 years ago
parent
commit
f4283be677
  1. 3
      opentracker.c
  2. 3
      ot_accesslist.c
  3. 4
      ot_stats.c

3
opentracker.c

@ -237,7 +237,8 @@ static int64_t ot_try_bind( char ip[4], uint16_t port, PROTO_FLAG proto ) { @@ -237,7 +237,8 @@ static int64_t ot_try_bind( char ip[4], uint16_t port, PROTO_FLAG proto ) {
#ifdef _DEBUG
char *protos[] = {"TCP","UDP","UDP mcast"};
fprintf( stderr, "Binding socket type %s to address %d.%d.%d.%d:%d...", protos[proto],(int)ip[0],(int)ip[1],(int)ip[2],(int)ip[3],port);
uint8_t *_ip = (uint8_t *)ip;
fprintf( stderr, "Binding socket type %s to address %d.%d.%d.%d:%d...", protos[proto],_ip[0],_ip[1],_ip[2],_ip[3],port);
#endif
if( socket_bind4_reuse( s, ip, port ) == -1 )

3
ot_accesslist.c

@ -107,7 +107,8 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) { @@ -107,7 +107,8 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) {
memmove( g_adminip_addresses + g_adminip_count, ip, 4 );
g_adminip_permissions[ g_adminip_count++ ] = permissions;
#ifdef _DEBUG
fprintf( stderr, "Blessing ip address %d.%d.%d.%d with:", (uint8_t)ip[0], (uint8_t)ip[1], (uint8_t)ip[2], (uint8_t)ip[3]);
uint8_t *_ip = (uint8_t*)ip;
fprintf( stderr, "Blessing ip address %d.%d.%d.%d with:", _ip[0], _ip[1], _ip[2], _ip[3]);
if( permissions & OT_PERMISSION_MAY_STAT ) fputs( " may_fetch_stats", stderr );
if( permissions & OT_PERMISSION_MAY_SYNC ) fputs( " may_sync_batch", stderr );
if( permissions & OT_PERMISSION_MAY_LIVESYNC ) fputs( " may_sync_live", stderr );

4
ot_stats.c

@ -512,14 +512,14 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_ @@ -512,14 +512,14 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_
break;
case EVENT_FULLSCRAPE_REQUEST:
{
unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */
uint8_t ip[4]; *(uint32_t*)ip = (uint32_t)proto; /* ugly hack to transfer ip to stats */
LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] );
ot_full_scrape_request_count++;
}
break;
case EVENT_FULLSCRAPE_REQUEST_GZIP:
{
unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */
uint8_t ip[4]; *(uint32_t*)ip = (uint32_t)proto; /* ugly hack to transfer ip to stats */
LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE GZIP\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] );
ot_full_scrape_request_count++;
}

Loading…
Cancel
Save