NetProg 2002 HW6 FAQ


Question:

The project description says "your client should be capable of using either IPv4 or IPv6, depending on the server address specified on the command line". does it mean I need to tell the client to use a IPv4 or IPv6 address for itself to connect to the server? for example, when I specify the command like this:

./client <serverhost> <server port> 4
the client should use a IPv4 address for itself, and when the command line is like:
./client <server host> <server  port> 6
client should choose IPv6 address instead? is that what you mean?

Answer:

You should not need a command line parameter that specifies what kind of address is being used. The whole idea is to write a generic client that could use any kind of address. Your client should use IPv4 if the server address specified on the command line is an IPv4 address. So if you see this:

./client 128.213.4.1 3456
the client should create an IPv4 socket and give connect (or sendto) a sockaddr_in. If you see this:
./client fe80::a00:20ff:fe82:fa21 3456
the client should create an IPv6 socket and give connect (or sendto) a sockaddr_in6. Note that if you use getaddrinfo to create the sockaddr and determine the value of the parameters you need to create the right socket, you don't need to do anything special to distinguish between the 2 types of addresses - getaddrinfo does all the work! The code could now also work (in the future) with any new address family supported by sockets.




Question:

How do I find out the IPv6 address of a machine?

Answer:

On the CS suns you type the comand ifconfig -a (the full path is /usr/sbin/ifconfig). On eggbeater it looks like this:

>  /usr/sbin/ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
hme0: flags=1004843 mtu 1500 index 2
        inet 128.213.8.24 netmask ffffff00 broadcast 128.213.8.255
lo0: flags=2000849 mtu 8252 index 1
        inet6 ::1/128 
hme0: flags=2000841 mtu 1500 index 2
        inet6 fe80::a00:20ff:fe82:fa21/10 

This shows that the IPv6 address of eggbeater is fe80::a00:20ff:fe82:fa21




Question:

How do I tell bind to give me any IPv6 address? I tried using INADDR_ANY but it doesn't work with an IPv6 address.

Answer:

You can initialize a struct in6_addr to have the value IN6ADDR_ANY_INIT, then use the resulting in6_addr variable to assign this value in the sockaddr. Example:

  struct in6_addr foo=IN6ADDR_ANY_INIT;
  struct sockaddr_in6 skadr;

  ...

  skadr.sin6_addr = foo;
  ...

  

Note that IN6ADDR_ANY_INIT is legal as an initialization of a variable only, you can't assign it directly to skadr.sin6_addr! (That's why it's IN6ADDR_ANY_INIT and not IN6ADDR_ANY...).




Question:

The project description doesn't say what to do about <insert name of some implementation detail here>. How are we supposed to handle this?

Answer:

You are given lots of freedom to make these decisions yourself, go for it! Just make sure you tell us whatever we need to know to be able to build and run your system!




Question:

Is there a demonstration system?

Answer:

No. Dave knows from experience that if a demonstration system was provided, too many people would simply copy his design (instead of coming up with their own).




Question:

What happened with Brittney?

Answer:

I have no idea. Feel free to make up the rest, send it to me and I'll make it available to others.