1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

(trunk libT) #2667 "ignore martian addresses" -- revise the tests to tr_isValidPeerAddr() base

d on feedback from jch @ http://trac.transmissionbt.com/ticket/2667#comment:6
This commit is contained in:
Charles Kerr 2009-12-15 19:39:01 +00:00
parent c819d6dca6
commit 33c6b0d9ec

View file

@ -606,11 +606,9 @@ isMulticastAddress( const tr_address * addr )
}
static tr_bool
isIPv4MappedOrCompatAddress( const tr_address * addr )
isIPv4MappedAddress( const tr_address * addr )
{
return ( ( addr->type == TR_AF_INET6 )
&& ( IN6_IS_ADDR_V4MAPPED( &addr->addr.addr6 )
|| IN6_IS_ADDR_V4COMPAT( &addr->addr.addr6 ) ) );
return ( addr->type == TR_AF_INET6 ) && IN6_IS_ADDR_V4MAPPED( &addr->addr.addr6 );
}
static tr_bool
@ -663,6 +661,6 @@ tr_isValidPeerAddress( const tr_address * addr, tr_port port )
&& ( tr_isAddress( addr ) )
&& ( !isMulticastAddress( addr ) )
&& ( !isIPv6LinkLocalAddress( addr ) )
&& ( !isIPv4MappedOrCompatAddress( addr ) )
&& ( !isIPv4MappedAddress( addr ) )
&& ( !isMartianAddr( addr ) );
}