From: Ralph Ronnquist Date: Mon, 17 Feb 2025 11:26:06 +0000 (+1100) Subject: Only log start packets X-Git-Tag: 0.1~1 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=09b0516aa4eef369855161760adf78e7d5c81d89;p=rrq%2Fnfblocker.git Only log start packets --- diff --git a/src/nfblocker.c b/src/nfblocker.c index b889d36..4a5bd9b 100644 --- a/src/nfblocker.c +++ b/src/nfblocker.c @@ -67,7 +67,8 @@ static const char *tell_ip(struct packet *ip) { case 6: return inet_ntop( AF_INET6, &ip->p.packet6.first.ip6_dst, THEIP, 200 ); } - return strcpy( THEIP, "???" ); + snprintf( THEIP, 200, "%d ???", ip->p.packet_type ); + return THEIP; } /** @@ -231,12 +232,16 @@ static int cb( if ( length >= 100 ) { unsigned char *host = http_host( data, length ); #if 1 + if ( host ) { fprintf( stderr, "HTTP HOST %s %s\n", tell_ip( header ), host ); + } #endif if ( host == 0 ) { host = ssl_host( data, length ); #if 1 - fprintf( stderr, "SSL HOST %s %s\n", tell_ip( header ), host ); + if ( host ) { + fprintf( stderr, "SSL HOST %s %s\n", tell_ip( header ), host ); + } #endif } if ( host ) {