17.2 | Modify the get_ifi_info program to issue its first SIOCGIFCONF request for one ifreq structure and then increment the length each time around the loop by the size of one of these structures. Next, put some statements in the loop to print the buffer size each time the request is issued, whether or not ioctl returns an error, and upon success print the returned buffer length. Run the prifinfo program and see how your system handles this request when the buffer size is too small. Also print the address family for any returned structures whose address family is not the desired value to see what other structures are returned by your system. |
17.3 | Modify the get_ifi_info function to return information about an alias address if the additional address is on a different subnet from the previous address for this interface. That is, our version in Section 17.6 ignored the aliases 206.62.226.44 through 206.62.226.46, which is acceptable since they are on the same subnet as the primary address for the interface, 206.62.226.33. But if, in this example, an alias is on a different subnet, say 192.3.4.5, return an ifi_info structure with the information about the additional address. |