I'm trying to write a DNS server for windows, using WinPcap. The coding seems to be working and it's answering to the queries. But before each response, windows is sending an ICMP packet, saying "Destination unreachable (port unreachable)". It's like my windows doesn't know that i'm going to answer on port 53, so it assumes that it's going to be unreachable or something. I really don't know. I've also disabled my firewall. Server and Client are both on my windows, using GNS3. I'm also using my Microsoft Loopback interface.
Thanks
Of course Windows doesn't know that because your app isn't actually listening to (i.e. accepting) the port 53. When the Windows receives a UDP packet from the loopback, then it checks its destination port and if nobody is opening the port it sends ICMP error.
To avoid the error, you have two choices; open the port 53 or don't let the Windows receive packets you send.
For the former, create another app that binds port 53 to a socket and just discard packets it receives via the socket, and run it with your packet capture app.
For the latter, set the destination address (IP or MAC) to one that is not assigned to no one.