Once you create your development sandbox, the source code for this example is available in the following locations:
For information about creating your development sandbox, see "Creating Reference and Development Sandboxes" in the Installation Guide.
The IP Reassembler sample code demonstrates two ways to handle IP fragment reassembly: using a daemon and using a plugin. Both examples run on the Juniper Networks Multiservices PIC or DPC hardware module. When you use a plugin, however, the plugin framework takes care of any required reassembly automatically. Thus, the plugin version simply passes traffic through and logs any fragment packets that it sees (which should be none).
The design for the daemon version assumes that the application will operate in the data path. The data component of the application reads the configuration from command-line options and performs the IP reassembly.
User interfaces for SDK applications usually derive from the JUNOS user interface, with both configuration and command components (for an introduction, see System and User Interface Configuration). However, this application has no management component to implement the UI, so it uses command-line options with the daemon. These are defined at the time of packaging, not runtime.
- Applications also usually include a management component running in the router's control plane to control the behavior of the application. However, to keep this demonstration focused on the reassembler functionality, this code includes only a data component.
The command-line options are as follows:
-N option is used when starting the application as a daemon and there is no need for it to "daemonize" itself. This should be used when the process is being launched in the typical way from the init process on the Multiservices PIC.
-v option can be used alone to show version information for the process.
-l option turns on logging to
STDERR as well as to syslog.
-d <#> option sets the debug level used for internal SDK APIs.
The plugin version of Reassembler serves as a good starting point for learning the plugin model and its associated events. You can compare the code to the daemon version to see how to code event handlers to let the plugin framework handle the reassembly logic for you.
-m <#> option is optional and specifies a number between 576 and 9192. This number represents the largest size packet that the system will build out of IP fragments. The number should ideally match the maximum transmission unit (MTU) on the target egress network interface. If it is larger, the system could build a packet that is too large to be sent out an egress interface. In that case, the Packet Forwarding Engine will re-fragment the IP packet that the system constructed in order to send it successfully. If the number is smaller than the target MTU, packets will be smaller than necessary. The default MTU size used is 9192. If this argument is specified, it must be the first one.
When the plugin receives a packet, it writes a log message in the following format:
"<source IP address> -> <destination IP address>"
These messages are built when observing the first packet of each session, and the strings are stored in the session context for use with subsequent packets in the same session.
IP Reassembly in the Daemon
© 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