I have NDK version ndk_2_25_00_09 and want to detect IP conflicts on the network to decide to stop the Stack to normalize the network behavior and improve the accessibility for each node
by detecting a conflict I mean detecting that another machine or Mac address has the same IP on the network so
1. the first approach
during startup, I attempted to ping on my local IP, and if the ping success continue normal operation, and If failed stop the NDK stack but
- when my ethernet cable is not connected to the device ping request succeeded even though I am not actually on the network so, in this case, I am pinging myself and in this case, actually I notice that the device not forwarding ping requests on the network - even on my PC when pinging myself I don't see ICMP packets on wireshark but when I ping another IP I see the ICMP packets out on the Ethernet Connection
- also when the cable is connected to my (switch or router) and my ip exists on the network before, (Conflict case that I want to detect) the device failed to ping its IP as it is not receiving its own ICMP packet so I got ping failure of ICMP request timeout and sometimes this case is validated and I got a success if I started the device then started the conflicted device so according to the first node connected to the Ethernet bus it will be validated but actually take the decision of disabling the network according to ping failure or not is not sufficient as it may be many cases one of them is the conflict
2. second approach
I used the arp table to check if my local IP exists on the cached arp entries or not and if exists so there is a conflict and if not then there is no conflict but
- this table is cached so what if the node exists on the bus but is never registered on my local arp cache as the arp table is only filled with arp packet reception which is triggered during communication only so
what if the device is configured and initialized on the stack but never sent a request to another node so this node doesn't have an ip entry of this node and attempts to change its own IP to the other ip node on the bus?
so is there a way inside the NDK to detect a conflict or a methodology that I can follow to detect the conflict without affection or violating any protocol rules?