Saturday, October 31, 2009

10.7 ip_slowtimo Function

Team-Fly
 

 

TCP/IP Illustrated, Volume 2: The Implementation
By
Gary R. Wright, W. Richard Stevens
Table of Contents
Chapter 10. 
IP Fragmentation and Reassembly


10.7 ip_slowtimo Function


As shown in Section 7.4, each protocol in Net/3 may specify a function to be called every 500 ms. For IP, that function is ip_slowtimo, shown in Figure 10.30, which times out the fragments on the reassembly list.



Figure 10.30. ip_slowtimo function.


515-534

ip_slowtimo traverses the list of partial datagrams and decrements the reassembly TTL field. ip_freef is called if the field drops to 0 to discard the fragments associated with the datagram. ip_slowtimo runs at splnet to prevent the lists from being modified by incoming packets.


ip_freef is shown in Figure 10.31.



Figure 10.31. ip_freef function.


470-486

ip_freef removes and releases every fragment on the list pointed to by fp and then releases the list itself.


ip_drain Function


In Figure 7.14 we showed that IP defines ip_drain as the function to be called when the kernel needs additional memory. This usually occurs during mbuf allocation, which we described with Figure 2.13. ip_drain is shown in Figure 10.32.



Figure 10.32. ip_drain function.


538-545

The simplest way for IP to release memory is to discard all the IP fragments on the reassembly list. For IP fragments that belong to a TCP segment, TCP eventually retransmits the data. IP fragments that belong to a UDP datagram are lost and UDP-based protocols must handle this at the application layer.





    Team-Fly
     

     
    Top
     


    No comments:

    Post a Comment