This is automatically generated documentation. Edit after the "COMMENTS" heading; changes to the main body will be lost.

User-Level Driver

Click user-level driver


click [options] [param=value ...] [router-file]


The click driver executes a Click modular router specification in a user-level program. It reads a router configuration file, sets up the router according to that file, and generally continues until interrupted. The router configuration is written in the Click language (see click(5)), and can contain dynamically loadable code, which click will link against before installing the configuration.

The click program can read and write packets from the network using Berkeley Packet Filters -- see FromDevice.u and ToDevice.u. It can also read and write BPF dump files, such as those created by tcpdump(1) -- see FromDump and ToDump. The InfiniteSource element, and others like it, may be useful for testing configurations without affecting the network.


Arguments such as "NAME=value" set configuration parameters, overriding any existing settings. Thus, "echo 'Message($MSG)' | click MSG=Hi" will print "Hi".

If any filename argument is a single dash "-", click will use the standard input or output instead, as appropriate.

-f file
--file file
Read the router configuration from file. The default is the standard input.
-e expr
--expression expr
Use expr, a string in the Click language, as the router configuration.
-p port
--port port
Open a ControlSocket connection listening on TCP port port. ControlSockets allow users to connect to the router and call its read and write handlers remotely. The names of added ControlSocket elements will be "click_driver@@ControlSocket", "click_driver@@ControlSocket@1", "click_driver@@ControlSocket@2", and so forth.
-u file
--unix-socket file
Open a ControlSocket connection listening on a Unix socket, on file file.
-R, --allow-reconfigure
Provide a "hotconfig" handler, which allows remote ControlSocket users, and elements within the router, to reconfigure the router dynamically. See click.o(8)'s "/click/hotconfig" section for more information on hot-swapping.
-j N
--threads N
Run with N threads. Only available if Click was configured with the --enable-user-multithread option.
Run in simulation time rather than real time, turning Click into an event-based simulator. In simulation time, the driver starts running at time 1000000000. Every request for the current time advances the simulated clock by 1 subsecond (either 1 microsecond or 1 nanosecond, depending on Click's timestamp precision). The simulated clock jumps ahead to the next scheduled Timer event whenever a real-time Click process would block. This mode is particularly useful for tests.
-h [element.]handler
--handler [element.]handler
After running the driver, call element's read handler named handler, or the global read handler named handler, and print the result to standard output. Each element has several generic handlers -- for example, config returns the element's configuration string and class returns the element's class name. Some elements have additional handlers; Counter, for example, has count and rate handlers that return the number of packets arrived and the recent arrival rate in packets per second. See linuxmodule for more information on generic handlers, and the element documentation for more information on element-specific handlers.

element may be a pattern that uses the shell's globbing syntax (*, ?, and [...]). In this case, click will run each handler whose element's name matches the pattern. element may also be an element class or interface name, such as "Queue" or "Storage"; click will run each handler whose element has that class or interface.
-x [element.]handler
--exit-handler [element.]handler
After running the driver, call element's read handler named handler, or the global read handler named handler, and use the result as the click process exit value. The handler should return an integer, which is used directly, or a boolean (true means 0, false means 1).
-o file
--output file
Write a flattened version of the router configuration to file. The flattening process removes all compound elements and additional archive members.
-q, --quit
Do not run the driver. This option can be used to check a configuration for errors, or to check handler results (with the --handler option) without running the configuration.
-t, --time
Print the time it took to run the driver.
-w, --no-warnings
Do not print any warning messages.
-C path
--clickpath path
Use path for CLICKPATH.
Print usage information and exit.
Print the version number and some quickie warranty information and exit.


The CLICK_BACKTRACE environment variable controls Click's printing of stack backtraces. Set CLICK_BACKTRACE to 1 and Click will print a stack backtrace immediately before crashing.


If you get an unaligned access error, try running your configuration through click-align first.



Eddie Kohler,


docs/userdriver.txt · Last modified: 2012/01/16 21:23 (external edit)
Recent changes RSS feed Driven by DokuWiki