mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-12-12 20:35:58 +01:00
Ignore packets that don't come from private networks
This commit is contained in:
@@ -132,6 +132,12 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
private void tcpPacketReceived(Socket socket) throws IOException {
|
||||
|
||||
InetAddress address = socket.getInetAddress();
|
||||
|
||||
if (!address.isSiteLocalAddress() && !address.isLinkLocalAddress()) {
|
||||
Log.i("LanLinkProvider", "Discarding UDP packet from a non-local IP");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rateLimitByIp(address)) {
|
||||
Log.i("LanLinkProvider", "Discarding second TCP packet from the same ip " + address + " received too quickly");
|
||||
return;
|
||||
@@ -209,6 +215,11 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
final InetAddress address = packet.getAddress();
|
||||
|
||||
if (!address.isSiteLocalAddress() && !address.isLinkLocalAddress()) {
|
||||
Log.i("LanLinkProvider", "Discarding UDP packet from a non-local IP");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rateLimitByIp(address)) {
|
||||
Log.i("LanLinkProvider", "Discarding second UDP packet from the same ip " + address + " received too quickly");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user