<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

CS 779/879
Design of Network Protocols
Spring 2006
Midterm Exam
Time 2 & 1/2 hours
Open Book & Notes

 

 

 

Name:                              
Login:

 


Question 1: (20  points)

  1. In UNIX OS, how to find out that a given host supports IPv6?

 

 

 

 

 

 

 

  1. Consider the following routing table of a give UNIX OS host:

 

Destination           Gateway            Flags    Ref    Use   Interface

-------------------- -------------------- ----- ----- ------ ---------

128.82.4.0            128.82.4.209         U            1     2432   eri0

224.0.0.0              128.82.4.209         U            1      0        eri0

default                  128.82.4.253         UG         1     265 

127.0.0.1              127.0.0.1               UH          6     2056   lo0

 

Describe the meaning of each   of the four lines?

 

 


Question 2: (20 points)

 

Consider the following two programs:

 

1.     UDPReceiver   <port>      [<mcast_addr1>   <mcast_addr2> …]

 

This program creates a udp socket, binds it  <port> and  INADDR_ANY, joins zero or more mcast addresses:  <mcast_addr1>  <mcast_addr2> … and then receives and displays any message received.   SO_REUSEADDR is on.

 

2.     UDPSender     <address>   < port>   <message>

 

The program sends  <message> to  UDPReceiver at <address>   < port>

 

Assume we have executed two programs on something (128.82.4.210) as follows:

% UDPReceiver  4567      >  File1 &

% UDPReceiver  4567      >  File2 &

% UDPReceiver  4567   224.2.2.2    >  File3 &

% UDPReceiver  4567   224.1.1.1    >  File4 &

% UDPReceiver  4567   224.1.1.1  224.2.2.2    >  File5 &

% UDPSend   128.82.4.210    4567    “HI 1111”

% UDPSend   224.1.1.1          4567    “HI 2222”

% UDPSend   224.2.2.2          4567    “HI 3333”

% UDPSend   224.3.3.3          4567    “HI 4444”

% UDPSend   224.1.1.1          1234    “HI 5555”

% UDPSend   127.0.0.1          4567   “HI  6666”

% UDPSend   128.82.4.210    1234    “HI 7777”


 

% cat File1

 

 

 

 

 

% cat File2

 

 

 

 

 

% cat File3

 

 

 

 

 

% cat File4

 

 

 

 

 

% cat File5

 


Question 3: (20 points)

 

1.     How to use Stevens’s sock program to implement the functionality of the UDPSend program?

 

 

 

 

 

 

2.     How to use the tcpdump program to capture all the traffic (and no other traffic) generated by all the commands of Question 2?

 

 

 

 

 

 

3.     How to use lsof   program to find information about all sockets used by the programs of Question2?

 

 

 

 

         What do you expect the answer should be?

 


 

Question 4: (20 points)

1.     In  I3, describe how to implement an n-party chat (similar to the behavior of the  mchat  program).

 

 

 

 

 

 

 

 

 

2.     In I3 routing using the Chord protocol, assume we have m=10 and eight i3 servers uniformly distributed over the ring starting at position 0. Show the content of routing table for the server located at position 0.


 

Question 5: (20 points)

To allow two groups to exchange multicast messages we may use an  udp tunnel  between the two groups as shown below:

 

The program mTunnel has the following syntax:

 

mTunnel  <remote uhost>  <remote uport>  <mcastaddress>  <mcastport>

 

For example:

A> mTunnel   128.82.4.42   1234   224.1.1.1   2345

B> mTunnel   152.2.61.14   1234   224.2.2.2   4567

 

Here is an outline for the mTunnel code:


 

#define SA      struct sockaddr
 
main(int argc,char *argv[])
{

int  uSock,  mSock;

struct  sockaddr_in  uHost, rHost, mHost, mGroup;

 

 

uHost.sin_family = AF_INET;

uHost.sin_port = htons (argv[2]);

uHost.sin_addr.s_addr = htonl (INADDR_ANY);

 

uSock = socket(PF_INET,SOCK_DGRAM, 0));

bind(uSock, (SA *) &uHost, sizeof(uHost) );

 

mHost.sin_family = AF_INET;

mHost.sin_port = htons(argv[4]);

mHost.sin_addr.s_addr  = htonl(INADDR_ANY);

 

mSock = socket(PF_INET,SOCK_DGRAM, 0));

bind(mSock,(SA *) &mHost, sizeof(mHost) );

reusePort(mSock);

joinGroup(mSock, argv[3]);

 

 

rHost.sin_family = AF_INET;

rHost.sin_port = htons(argv[2]);

rHost.sin_addr.s_addr  =  htonl(argv[1]);

 

mGroup.sin_family=AF_INET;

mGroup.sin_port = htons (argv[4]);

mGroup.sin_addr.s_addr = htonl (argv[3]);

 

switch  (uSock, mSock, (SA *) &rHost, (SA *) &mGroup);

}

 


void Switch  (int  uSock, int  mSock,  SA *rHost,  SA *mGroup)

{

/*   In this question, you are asked to complete this function,

      Using select to:

·        read a unicast message from uSock and send it to mSock   for  mGroup &

·        read an mcast message from mSock and sends it to uScok  for  rHost

 */

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
}