Thursday, October 29, 2009

6.5 in_ifaddr Structure

Team-Fly
 

 

TCP/IP Illustrated, Volume 2: The Implementation
By
Gary R. Wright, W. Richard Stevens
Table of Contents
Chapter 6. 
IP Addressing


6.5 in_ifaddr Structure


Figure 6.8 shows the interface address structure defined for the Internet protocols. For each IP address assigned to an interface, an in_ifaddr structure is allocated and added to the interface address list and to the global list of IP addresses (Figure 6.5).



Figure 6.8. The in_ifaddr structure.


41-45

in_ifaddr starts with the generic interface address structure, ia_ifa, followed by the IP-specific members. The ifaddr structure was shown in Figure 3.15. The two macros, ia_ifp and ia_flags, simplify access to the interface pointer and interface address flags stored in the generic ifaddr structure. ia_next maintains a linked list of all Internet addresses that have been assigned to any interface. This list is independent of the list of link-level ifaddr structures associated with each interface and is accessed through the global list in_ifaddr.


46-54

The remaining members (other than ia_multiaddrs) are included in Figure 6.9, which shows the values for the three interfaces on sun from our example class B network. The addresses stored as u_long variables are kept in host byte order; the in_addr and sockaddr_in variables are in network byte order. sun has a PPP interface, but the information shown in this table is the same for a PPP interface or for a SLIP interface.



Figure 6.9. Ethernet, PPP, and loopback in_ifaddr structures on sun.


55-56

The last member of the in_ifaddr structure points to a list of in_multi structures (Section 12.6), each of which contains an IP multicast address associated with the interface.




    Team-Fly
     

     
    Top
     


    No comments:

    Post a Comment