**This is automatically generated documentation.** Edit after the "[[#COMMENTS|COMMENTS]]" heading; changes to the main body will be lost. ====== FromDevice.u Element Documentation ====== ===== NAME ===== **FromDevice.u** -- Click element; reads packets from network device (user-level) ===== SYNOPSIS ===== [[FromDevice]](DEVNAME [, //keywords// SNIFFER, PROMISC, SNAPLEN, FORCE_IP, CAPTURE, BPF_FILTER, OUTBOUND]) **Ports**: no inputs, 1 output\\ **Processing**: push\\ **Drivers**: userlevel\\ **Package**: userlevel (core)\\ ===== DESCRIPTION ===== This manual page describes the user-level version of the [[FromDevice]] element. For the Linux kernel module element, read the [[FromDevice]] manual page. Reads packets from the kernel that were received on the network controller named DEVNAME. User-level [[FromDevice]] behaves like a packet sniffer by default. Packets emitted by [[FromDevice]] are also received and processed by the kernel. Thus, it doesn't usually make sense to run a router with user-level Click, since each packet will get processed twice (once by Click, once by the kernel). Install firewalling rules in your kernel if you want to prevent this, for instance using the [[KernelFilter]] element or [[FromDevice]]'s SNIFFER false argument. Under Linux, a [[FromDevice]] element will not receive packets sent by a ToDevice element for the same device. Under other operating systems, your mileage may vary. Sets the packet type annotation appropriately. Also sets the timestamp annotation to the time the kernel reports that the packet was received. Keyword arguments are: ? **SNIFFER** ! Boolean. Specifies whether [[FromDevice]] should run in sniffer mode. In non-sniffer mode, [[FromDevice]] installs [[KernelFilter]] filtering rules to block the kernel from handling any packets arriving on device DEVNAME. Default is true (sniffer mode). ? **PROMISC** ! Boolean. [[FromDevice]] puts the device in promiscuous mode if PROMISC is true. The default is false. ? **SNAPLEN** ! Unsigned. On some systems, packets larger than SNAPLEN will be truncated. Defaults to 2046. ? **FORCE_IP** ! Boolean. If true, then output only IP packets. (Any link-level header remains, but the IP header annotation has been set appropriately.) Default is false. ? **CAPTURE** ! Word. Defines the capture method [[FromDevice]] will use to read packets from the kernel. Linux targets generally support PCAP and LINUX; other targets support only PCAP. Defaults to LINUX on Linux targets (unless you give a BPF_FILTER), and PCAP elsewhere. ? **BPF_FILTER** ! String. A BPF filter expression used to select the interesting packets. Default is the empty string, which means all packets. If CAPTURE is not PCAP, then any filter expression is ignored with a warning. ? **OUTBOUND** ! Boolean. If true, then emit packets that the kernel sends to the given interface, as well as packets that the kernel receives from it. Default is false. ===== EXAMPLES ===== FromDevice(eth0) -> ... ===== NOTES ===== [[FromDevice]] sets packets' extra length annotations as appropriate. ===== ELEMENT HANDLERS ===== ? **count (read-only)** ! Returns the number of packets read by the device. ? **reset_counts (write-only)** ! Resets "count" to zero. ? **kernel_drops (read-only)** ! Returns the number of packets dropped by the kernel, probably due to memory constraints, before [[FromDevice]] could get them. This may be an integer; the notation ''"