1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

(trunk libT) use IN_MULTICAST macro

This commit is contained in:
Erick Turnquist 2009-01-02 21:45:55 +00:00
parent 86d3e70121
commit 5086cbe47c

View file

@ -48,6 +48,10 @@
#include "platform.h" #include "platform.h"
#include "utils.h" #include "utils.h"
#ifndef IN_MULTICAST
#define IN_MULTICAST( a ) ( ( ( a ) & 0xf0000000 ) == 0xe0000000 )
#endif
const tr_address tr_in6addr_any = { TR_AF_INET6, { IN6ADDR_ANY_INIT } }; const tr_address tr_in6addr_any = { TR_AF_INET6, { IN6ADDR_ANY_INIT } };
const tr_address tr_inaddr_any = { TR_AF_INET, const tr_address tr_inaddr_any = { TR_AF_INET,
{ { { { INADDR_ANY, 0x00, 0x00, 0x00 } } } } }; { { { { INADDR_ANY, 0x00, 0x00, 0x00 } } } } };
@ -411,7 +415,7 @@ tr_netOpenTCP( tr_session * session,
assert( tr_isAddress( addr ) ); assert( tr_isAddress( addr ) );
/* don't try to connect to multicast addresses */ /* don't try to connect to multicast addresses */
if( addr->type == TR_AF_INET && ( ntohl( addr->addr.addr4.s_addr ) & 0xe0000000 ) ) if( addr->type == TR_AF_INET && IN_MULTICAST( htonl( addr->addr.addr4.s_addr ) ) )
return -EINVAL; return -EINVAL;
if( addr->type == TR_AF_INET6 && ( addr->addr.addr6.s6_addr[0] & 0xff ) ) if( addr->type == TR_AF_INET6 && ( addr->addr.addr6.s6_addr[0] & 0xff ) )
return -EINVAL; return -EINVAL;