| Question:   | Can you tell me how these project will be graded? | |
| Answer:   | The general formula is:
The exact tests we will run on your program will not be listed ahead of time, you should expect your client to be abused in all possible ways! Since your program is a client, it's safe to simply print out a message and quit whenever something goes wrong (if you can't recover). This is much harder to handle when your program is a server... Note: We shouldn't be able to crash your program! By "crash", I mean a SEGV or BUS ERROR, etc. Your program should quit on it's own when something goes wrong. | |
| | ||
| Question:   | What is a bit? a byte? a character? a pointer? | |
| Answer:   |
Dave has very little hair left as it is... please don't
ask questions that can be answered by any CS1 student. | |
| Question:   | I'm using x = ( * ((short int *) buff+x)); to extract a short int from a buffer, and I keep getting a BUS ERROR. What's up with that?
| |
| Answer:   |
On a Sun, You can't access a short int at an odd address. Since DNS messages include variable length fields (domain names), you can end up with short ints on odd addresses. Usememcpy!
| |
| | ||
| Question:   | Is it possible that a single domain name in a resource record can involve following more than one pointer (compression)? | |
| Answer:   | Yes. | |
| | ||
| Question:   | How do I handle CNAME replys. | |
| Answer:   | Handle them any way you like, we won't test your code on any hostnames that are not the real name. As a student pointed out - if you don't handle CNAME responses right, it can lead to the situation where you keep getting bounced back and forth between 2 servers. This project does not require you to handle CNAMES responses, as we will not test your code on any host aliases (we will always use the real name). | |
| | ||
| Question:   | Can you give me a hint on how I could declare a dns message structure? I know the sizes of the fields, and how to do bit masking and all that, but I don't know how to define a message in terms of ints, chars, longs, etc.. I am assuming it would be all ints, but I am not sure. | |
| Answer:   | For a message structure like the one used by DNS, it's not really possible to build one C structure definition that can be sent/received as a DNS message. The variable length fields are a problem, but there is also a problem with having short ints aligned on odd addresses (this is not supported on many architectures, include Sparc). I suggest you define whatever structures you want for your own use,
and write a function that can convert this structure to/from a DNS
message as a bunch of bytes (char). So the actual address you give to
char buf[512]; // UDP DNS messages are 512 bytes max! // build a DNS query in buf. Assume you have variables/structures/whatever // that are set to the values you want to put in the DNS message // assumes id is a short int with a valid DNS message // identifier in network byte order memcpy(buf,&id,2); // assumes flags is a short int that is set to the right value to // represent the flag settings for this query memcpy(buf+2,&flags,2); // set the rest of the message in buf. ... // now we can call sendto res = sendto(sock,buf,len,0,serveraddr,sockaddrlen); // and check for errors, etc. here | |
| | ||
| Question:   | Can you provide a sample query and response? I'm not sure what I should be getting back. | |
| Answer:   | Below is the output of a client that first prints out the fields in the query it is sending, then prints out the response received and all the resource records in it. This specific query asked the name server running on 128.213.1.1 for the address of "www.rpi.edu" without requesting recursion.:
| |