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.
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 126.96.36.199 through 188.8.131.52, which is acceptable since they are on the same subnet as the primary address for the interface, 184.108.40.206. But if, in this example, an alias is on a different subnet, say 220.127.116.11, return an ifi_info structure with the information about the additional address.