TWiki
>
CS450 Web
>
Homework1
>
Homeworks
>
Homework3
(2013-02-09, Main.ckanich)
(raw view)
E
dit
A
ttach
---+ Homework 3 - DNS resolution In this homework, we talk to the global domain name system to resolve domain names into IP addresses. Some good domain names to try, which you definitely will be tested on. Additional domains may be added if we find something *even more* interesting than these. <verbatim> www.domain.invalid nonexistent.kaytwo.org www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com ds.v6ns.test-ipv6.com ipv6.google.com www.cs.uic.edu www.yahoo.com.tw nibbles.cs.uic.edu www.uic.edu </verbatim> To get started, check out the hw3 template from svn://cs450.cs.uic.edu/pub/homeworks/hw3 This code already does DNS querying and parsing for you. Your responsibility is to modify the hw3 to work as follows: The file root-servers.txt contains a list of DNS root servers. Your application must use this file to find a working root server to use. You can assume it will always be called root-servers.txt, and exist in the current working directory. If a server does not respond, your code must move on to the next server. Its parameters and output are illustrated below. Try to match the output as closely as possible: there should not be lots of extra lines of debug output etc. in the final version. You are obviously not allowed to use gethostbyname or getaddrinfo for this homework, nor are you allowed to run any executables such as `host' or `nslookup' or `dig' from inside your program. ---+ Hints To time out on a recv() call (in case you get no answer), use setsockopt() with the SO_RECVTIMEO option: http://linux.die.net/man/7/socket Alternatively, you can use alarm(), and set up a handler for SIGALRM. "man alarm()" and "man signal" will help you set that up. Or try the newer sigitimer(). Either way, look for errno==EINTR (for alarm) or errno=EAGAIN (for timeout) when recv() returns -1 when using these techniques to see if you actually timed out. If you want to jump off the deep end of the pool, use a select() call (which takes a timeout parameter) instead of the blocking recv(). You can try out the template version like this: <verbatim> ./hw3 -d -n nameserver -i domain </verbatim> to find your local DNS server, check your network settings, or run "cat /etc/resolv.conf" on a non-windows machine. *Massive hint: recursion is your friend.* ---+ Turn-in instructions The same rules apply for your submission as for previous homeworks, with *one big exception*: you are now expected to commit at least 4 revisions, each with significant edits and intelligible commit comments, at least 10 minutes apart, reflecting your progress toward the final turned-in result. For example, you may commit the template version, a version that is able to read 'root-servers.txt', a broken version that doesn't work at all, a version that can do the v4 but not v6 lookups, a version that handles all but the difficult ds.v6ns.test-ipv6.com example, and the final version. Remember to write a comment that indicates the current status of your project. You are of course welcome to make many more commits if you please. To see how many commits you have, and to read the messages, use svn log To see the difference between two revisions, say revision r129 and r157, use svn diff -r 129:157 ---+ Example use sessions Program usage and example runs are given below. Implementation of command line option handling is given in the template. <verbatim> ./hw3 -i www.domain.invalid www.domain.invalid IPv4 address: not found. www.domain.invalid IPv6 address: not found. ./hw3 -i nonexistent.kaytwo.org nonexistent.kaytwo.org IPv4 address: not found. nonexistent.kaytwo.org IPv6 address: not found../hw3 -i www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com IPv4 address: 94.126.42.50 www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com IPv6 address: not found. ./hw3 -i ds.v6ns.test-ipv6.com ds.v6ns.test-ipv6.com IPv4 address: 216.218.228.114 ds.v6ns.test-ipv6.com IPv6 address: 2001:470:1:18::2 ./hw3 -i ipv6.google.com ipv6.google.com IPv4 address: not found. ipv6.google.com IPv6 address: 2607:f8b0:4003:c01::63 ./hw3 -i www.cs.uic.edu www.cs.uic.edu IPv4 address: 131.193.32.29 www.cs.uic.edu IPv6 address: not found. ./hw3 -i www.yahoo.com.tw www.yahoo.com.tw IPv4 address: 68.180.206.184 www.yahoo.com.tw IPv6 address: not found. ./hw3 -i nibbles.cs.uic.edu nibbles.cs.uic.edu IPv4 address: 131.193.34.150 nibbles.cs.uic.edu IPv6 address: not found. ./hw3 -i www.uic.edu www.uic.edu IPv4 address: 128.248.156.31 www.uic.edu IPv6 address: not found. </verbatim> ---+ Grading You can get the grading script using: =svn co svn://cs450.cs.uic.edu/pub/= or just =svn up= in your =/pub= if you already have one checked out. The grading script is in /pub/grading-scripts/hw3/. To run the grading script: =./hw3_score username score_file= This script will download hw3 from svn and create score_file inside hw3. The grading script will check the ip address following the first colon in the first two lines: the first for ipv4, and the second for ipv6. Credit is given if the output matches either a correct IP (in the case of multiple resolutions), or "not found." in the case of a nonexistent domain. If all test-cases are successful in grading script you will get 11 points from grading script. However, the following tests will be done manually and points will be deducted if your program can't handle the corresponding issues. <verbatim> -0.5: At least four descriptive commits are made -20: Hard codes a recursive nameserver to resolve the name </verbatim> The score file will look something like the following: <verbatim> starting grade run for ckanich (revision 16) at 09 Feb 2013 22:41:40 +0000 ----- testing non-recursive functionality testing command: ./hw3 -n 2001:4978:292:2::1 -i www.uic.edu ipv4 check for www.uic.edu successful: +0.50 pts ipv6 check for www.uic.edu successful: +0.50 pts ----- testing recursive lookup starting at root nameservers testing command: ./hw3 -i www.domain.invalid ipv4 check for www.domain.invalid successful: +0.50 pts ipv6 check for www.domain.invalid successful: +0.50 pts testing command: ./hw3 -i nonexistent.kaytwo.org ipv4 check for nonexistent.kaytwo.org successful: +0.50 pts ipv6 check for nonexistent.kaytwo.org successful: +0.50 pts testing command: ./hw3 -i www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com ipv4 check for www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com successful: +0.50 pts ipv6 check for www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com successful: +0.50 pts testing command: ./hw3 -i ds.v6ns.test-ipv6.com ipv4 check for ds.v6ns.test-ipv6.com successful: +0.25 pts ipv6 check for ds.v6ns.test-ipv6.com successful: +0.25 pts testing command: ./hw3 -i ipv6.google.com ipv4 check for ipv6.google.com successful: +0.50 pts ipv6 check for ipv6.google.com successful: +0.50 pts testing command: ./hw3 -i www.cs.uic.edu ipv4 check for www.cs.uic.edu successful: +0.25 pts ipv6 check for www.cs.uic.edu successful: +0.25 pts testing command: ./hw3 -i www.yahoo.com.tw ipv4 check for www.yahoo.com.tw successful: +0.25 pts ipv6 check for www.yahoo.com.tw successful: +0.25 pts testing command: ./hw3 -i nibbles.cs.uic.edu ipv4 check for nibbles.cs.uic.edu successful: +0.25 pts ipv6 check for nibbles.cs.uic.edu successful: +0.25 pts ----- testing with bad root servers testing command: ./hw3 -i www.cs.uic.edu ipv4 check for www.cs.uic.edu successful: +2.00 pts ipv6 check for www.cs.uic.edu successful: +2.00 pts final score: 11.00/11.00 </verbatim>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r4 - 2013-02-09 - 23:34:14 - Main.ckanich
CS450
CS450 Home
Syllabus
Homeworks
-
Using Subversion
Discussion Forum
Lecture Notes
Log In
CS450 Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
ABOUT US
Our Department
Recent News
Contact Us
ACADEMICS
Prospective Students
Undergraduate
CS Minor
Graduate
Courses
RESEARCH
Overview
By Faculty
Labs
PEOPLE
Faculty
Adjuncts
Staff
Students
Alumni
Copyright 2016 The Board of Trustees
of the University of Illinois.
webmaster@cs.uic.edu
WISEST
Helping Women Faculty Advance
Funded by NSF