I have the following setup:
Android Galaxy S5 Mini. Android version 5.1.1.
I have 2 network interfaces:
- Interface1 with ip: 192.168.5.1
- Interface2 with ip: 192.168.5.10
I create a DatagramSocket using Android SDK and bind it to address: 192.168.5.10(Interface 2), port 2525.
I put this socket in receive and wait for packets. I use another device to send the packets.
Packets from ip address: 192.168.5.4 is received.
Packets from ip address(different device): 192.168.5.1 (same as the device's Interface1 ip) is never received.
It seams that the network stack rejects packets which have source ip address which exists in the device, regardless of the interface it was received in.
If I modify the ip address for Interface1 to something other than 192.168.5.1 it works fine.
Devices on which it didn't happen:
- Samsung tablet T113 Android 4.4.4 (Stock rom)
- LG G4 Android 6.0 (Stock rom)
- LG Nexus 5X Android 7.1.2 (Stock rom)
Devices on which it did happen:
- Galaxy S5 Mini Android 5.1.1 (Stock rom)
- Galaxy Note 3 Android 6.0.1 (CyanogenMod)
- One+1 Android 6.0.1 (CyanogenMod)
What is the mechanism which rejects the packet with source IP 192.168.5.1(same as the device's Interface1 ip)?