As noted in the introduction, the daemon version of the reassembler requires more code to handle the fragment reassembly.
The simplest traffic case for this application is when packets are not fragmented. In this case, the application passes the packets through without further examination.
To perform defragmentation, the application sets up some data structures in object-cache shared memory. A shared hashtable allows the code to look up a hash value to access an ordered list of IP fragment packets seen up to that point in the same group. The hash key is composed of the source IP address, the destination IP address, the protocol encapsulated by the IP header, and the fragment group ID.
The reassembly logic is found in the
process_fragment() function in the file
The logic is as follows:
- When the application receives a fragment, it adds the fragment to the ordered list and checks to see if the list is complete.
- If the list is not complete, the code moves on to receive and process another packet.
- If the list is complete, and all fragments in the fragment group are present, the code rebuilds a new IP packet with the same header as the one at the head of the list without the fragment group set. It then checks to see if the new packet size is below the configured MTU.
- As long as the packet size is less than or equal to the MTU, the application sends out the newly constructed packet.
- If the packet size exceeds the MTU, the application refragments the packet at the MTU boundaries with the same fragment group ID. It then sends out the fragments.
- When fragmenting, the code copies all IP options for simplicity (this is not strictly required for all kinds of IP options).
jbuf API Usage in the Daemon Version
- This application always uses the maximum number of data CPUs available. It is, therefore, possible that the list of packets associated with each hash key is accessed by multiple data CPUs. This will cause increased lock contention. To minimize this, you should enable the
data-flow-affinity option in the configuration database for the MultiServices PIC on which the application is run. (For more information, see Flow Affinity on the Data Plane.)
© 2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:26:47 2010 for Juniper Networks Partner Solution Development Platform JUNOS SDK 10.2R1 by Doxygen 1.4.5