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