mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(trunk libT) #4016 "blocklists loaded in Transmission should be used to filter DHT communication." -- fixed.
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user