From 09b0516aa4eef369855161760adf78e7d5c81d89 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 17 Feb 2025 22:26:06 +1100 Subject: [PATCH] Only log start packets --- src/nfblocker.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 ) { -- 2.47.2