OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 1:37 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [solved] no DNS response from real router
PostPosted: Sat Jan 28, 2023 6:30 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
I am currently testing my code on real machine. My router properly responds to DHCP and ARP protocol, however, when I send DNS query, there is no response. So far I checked:
- my driver: there surely is not problem, it is working perfectly
- ARP: router properly responds to ARP request for DNS server IP
- DNS query: I doubt that error is here, because my code works under QEMU and Virtualbox and there is no error shown in Wireshark.
What is quite strange, when I start Virtualbox with network option bridge, router responds to DNS query properly. However when I start my OS on real computer, there is no DNS reply. So I am wondering that maybe there is some overlooked aspect in initalizing communication with real router. Here is how my code works now on real computer:
- > I send DHCP Discover asking for IP 192.168.1.100, router IP and Domain Name Server IP
< - Router send DHCP Offer with IP 192.168.1.100, router IP 192.168.1.1 and Domain Name Server IP 192.168.1.1
- > I send DHCP Request for 192.168.1.100
< - Router send ARP Request for IP 192.168.1.100
- > I send ARP Reply to router
< - Router send DHCP Acknowledge
- > I send DNS query
< - In QEMU, Virtualbox and even Virtualbox bridge Router responds with DNS Reply, however on real hardware it do not
Am I missing something? Any help would be appreciated.

P.S. I am currently rewriting BleskOS to C, so code on GitHub is not my actual code

_________________
https://github.com/VendelinSlezak/BleskOS


Last edited by Klakap on Mon Jan 30, 2023 8:53 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: no DNS response from real router
PostPosted: Sat Jan 28, 2023 7:04 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1590
I would guess that there is something wrong with your DNS query that QEMU and VBox are not checking but the router is. Dump the traffic into Wireshark, it is stricter about checking things.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: no DNS response from real router
PostPosted: Sat Jan 28, 2023 7:20 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Wireshark do not see anything wrong with my DNS query. Screenshot here is from Virtualbox bridge communication, therefore my IP is 192.168.1.101.


Attachments:
Snímka obrazovky_2023-01-28_14-16-51.jpg
Snímka obrazovky_2023-01-28_14-16-51.jpg [ 87.14 KiB | Viewed 1013 times ]

_________________
https://github.com/VendelinSlezak/BleskOS
Top
 Profile  
 
 Post subject: Re: no DNS response from real router
PostPosted: Sat Jan 28, 2023 12:43 pm 
Offline
Member
Member

Joined: Sat Feb 04, 2012 5:03 pm
Posts: 110
I can't imagine why, but on the real computer the DNS request might be different. Can you capture the packets sent? Easy options are: (1) run a packet capture on your router if you have a router that can do that (2) use an ethernet hub and a separate box to capture with, as long as the ethernet hub is either a dumb hub that forwards all packets to all ports, or is a switch that has a management UI that lets you set it up to forward all packets from a port to a capture port.


Top
 Profile  
 
 Post subject: Re: no DNS response from real router
PostPosted: Mon Jan 30, 2023 8:52 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
sounds wrote:
I can't imagine why, but on the real computer the DNS request might be different. Can you capture the packets sent?

Thank you for suggestion. I've solved this problem. It was really sneaky mistake. I used malloc() instead of calloc(). In emulators it do not matter, because they have zeroes in whole free memory, but it is not case on real computer. I was not rewriting all fields, so I was sending malformed packet. When I zeroed packet with calloc(), everything works perfectly.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group