(trunk libT) #4016 "blocklists loaded in Transmission should be used to filter DHT communication." -- fixed.
This commit is contained in:
parent
7b71470ea0
commit
a4e095b26f
|
@ -192,6 +192,8 @@ event_callback(int s, short type UNUSED, void *sv)
|
|||
unsigned char buf[4096];
|
||||
struct sockaddr_storage from;
|
||||
tr_session *ss = sv;
|
||||
tr_address addr;
|
||||
tr_port port;
|
||||
|
||||
assert(tr_isSession(sv));
|
||||
assert(type == EV_READ);
|
||||
|
@ -200,6 +202,11 @@ event_callback(int s, short type UNUSED, void *sv)
|
|||
rc = recvfrom(s, buf, 4096 - 1, 0,
|
||||
(struct sockaddr*)&from, &fromlen);
|
||||
|
||||
/* don't process messages from blocked addresses */
|
||||
if( !tr_address_from_sockaddr_storage( &addr, &port, &from )
|
||||
|| tr_sessionIsAddressBlocked( ss, &addr ) )
|
||||
return;
|
||||
|
||||
/* Since most packets we receive here are µTP, make quick inline
|
||||
checks for the other protocols. The logic is as follows:
|
||||
- all DHT packets start with 'd';
|
||||
|
|
Loading…
Reference in New Issue