mirror of
https://github.com/transmission/transmission
synced 2025-02-23 06:30:38 +00:00
(trunk libT) #4016 "blocklists loaded in Transmission should be used to filter DHT communication." -- fixed.
This commit is contained in:
parent
7b71470ea0
commit
a4e095b26f
1 changed files with 7 additions and 0 deletions
|
@ -192,6 +192,8 @@ event_callback(int s, short type UNUSED, void *sv)
|
||||||
unsigned char buf[4096];
|
unsigned char buf[4096];
|
||||||
struct sockaddr_storage from;
|
struct sockaddr_storage from;
|
||||||
tr_session *ss = sv;
|
tr_session *ss = sv;
|
||||||
|
tr_address addr;
|
||||||
|
tr_port port;
|
||||||
|
|
||||||
assert(tr_isSession(sv));
|
assert(tr_isSession(sv));
|
||||||
assert(type == EV_READ);
|
assert(type == EV_READ);
|
||||||
|
@ -200,6 +202,11 @@ event_callback(int s, short type UNUSED, void *sv)
|
||||||
rc = recvfrom(s, buf, 4096 - 1, 0,
|
rc = recvfrom(s, buf, 4096 - 1, 0,
|
||||||
(struct sockaddr*)&from, &fromlen);
|
(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
|
/* Since most packets we receive here are µTP, make quick inline
|
||||||
checks for the other protocols. The logic is as follows:
|
checks for the other protocols. The logic is as follows:
|
||||||
- all DHT packets start with 'd';
|
- all DHT packets start with 'd';
|
||||||
|
|
Loading…
Reference in a new issue