From 50d73a884f3116143757a9766a32ce171ee62950 Mon Sep 17 00:00:00 2001 From: Erick Turnquist Date: Wed, 31 Dec 2008 21:25:52 +0000 Subject: [PATCH] (trunk libT) Stop trying to connect to multicast addresses. Also, bump "funny looking address" messages from tr_dbg to tr_err so I can get bug reports with the message for once! --- libtransmission/net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libtransmission/net.c b/libtransmission/net.c index 523cbb3b3..d16fe2a26 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -73,7 +73,7 @@ tr_suspectAddress( const tr_address * a, const char * source ) { /* be really aggressive in what we report */ if( a->type == TR_AF_INET && !( a->addr.addr4.s_addr & 0xff000000 ) ) - tr_dbg( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); + tr_err( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); /* /16s taken from ipv6 rib on 21 dec, 2008 */ /* this is really, really ugly. expedience over quality */ if( a->type == TR_AF_INET6 ) @@ -94,7 +94,7 @@ tr_suspectAddress( const tr_address * a, const char * source ) p++; } if( !good ) - tr_dbg( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); + tr_err( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); } } @@ -416,6 +416,12 @@ tr_netOpenTCP( tr_session * session, assert( tr_isAddress( addr ) ); + /* don't try to connect to multicast addresses */ + if( addr->type == TR_AF_INET && ( addr->addr.addr4.s_addr & 0xe0000000 ) ) + return -EINVAL; + if( addr->type == TR_AF_INET6 && ( addr->addr.addr6.s6_addr[0] & 0xff ) ) + return -EINVAL; + if( ( s = createSocket( ( addr->type == TR_AF_INET ? AF_INET : AF_INET6 ), type ) ) < 0 ) return s;