summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2008-10-17 15:21:11 +0000
committererdgeist <>2008-10-17 15:21:11 +0000
commitf4283be67732c2edce701762d871cf7b8495dd4a (patch)
treed54c3b6f68f3d00dfceda7367cccf7d76787eb5a
parent0deb06d5442d4d65cf4251428d5977396cfbf023 (diff)
Fix debug output for addresses >127
-rw-r--r--opentracker.c3
-rw-r--r--ot_accesslist.c3
-rw-r--r--ot_stats.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/opentracker.c b/opentracker.c
index 2a746cf..fa63378 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -237,7 +237,8 @@ static int64_t ot_try_bind( char ip[4], uint16_t port, PROTO_FLAG proto ) {
237 237
238#ifdef _DEBUG 238#ifdef _DEBUG
239 char *protos[] = {"TCP","UDP","UDP mcast"}; 239 char *protos[] = {"TCP","UDP","UDP mcast"};
240 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); 240 uint8_t *_ip = (uint8_t *)ip;
241 fprintf( stderr, "Binding socket type %s to address %d.%d.%d.%d:%d...", protos[proto],_ip[0],_ip[1],_ip[2],_ip[3],port);
241#endif 242#endif
242 243
243 if( socket_bind4_reuse( s, ip, port ) == -1 ) 244 if( socket_bind4_reuse( s, ip, port ) == -1 )
diff --git a/ot_accesslist.c b/ot_accesslist.c
index 412c539..91e99b3 100644
--- a/ot_accesslist.c
+++ b/ot_accesslist.c
@@ -107,7 +107,8 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) {
107 memmove( g_adminip_addresses + g_adminip_count, ip, 4 ); 107 memmove( g_adminip_addresses + g_adminip_count, ip, 4 );
108 g_adminip_permissions[ g_adminip_count++ ] = permissions; 108 g_adminip_permissions[ g_adminip_count++ ] = permissions;
109#ifdef _DEBUG 109#ifdef _DEBUG
110 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]); 110 uint8_t *_ip = (uint8_t*)ip;
111 fprintf( stderr, "Blessing ip address %d.%d.%d.%d with:", _ip[0], _ip[1], _ip[2], _ip[3]);
111 if( permissions & OT_PERMISSION_MAY_STAT ) fputs( " may_fetch_stats", stderr ); 112 if( permissions & OT_PERMISSION_MAY_STAT ) fputs( " may_fetch_stats", stderr );
112 if( permissions & OT_PERMISSION_MAY_SYNC ) fputs( " may_sync_batch", stderr ); 113 if( permissions & OT_PERMISSION_MAY_SYNC ) fputs( " may_sync_batch", stderr );
113 if( permissions & OT_PERMISSION_MAY_LIVESYNC ) fputs( " may_sync_live", stderr ); 114 if( permissions & OT_PERMISSION_MAY_LIVESYNC ) fputs( " may_sync_live", stderr );
diff --git a/ot_stats.c b/ot_stats.c
index cc7dc30..8810151 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -512,14 +512,14 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_
512 break; 512 break;
513 case EVENT_FULLSCRAPE_REQUEST: 513 case EVENT_FULLSCRAPE_REQUEST:
514 { 514 {
515 unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */ 515 uint8_t ip[4]; *(uint32_t*)ip = (uint32_t)proto; /* ugly hack to transfer ip to stats */
516 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] ); 516 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] );
517 ot_full_scrape_request_count++; 517 ot_full_scrape_request_count++;
518 } 518 }
519 break; 519 break;
520 case EVENT_FULLSCRAPE_REQUEST_GZIP: 520 case EVENT_FULLSCRAPE_REQUEST_GZIP:
521 { 521 {
522 unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */ 522 uint8_t ip[4]; *(uint32_t*)ip = (uint32_t)proto; /* ugly hack to transfer ip to stats */
523 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] ); 523 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] );
524 ot_full_scrape_request_count++; 524 ot_full_scrape_request_count++;
525 } 525 }