⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kerneltap.hh

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 HH
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_KERNELTAP_HH#define CLICK_KERNELTAP_HH#include "kerneltun.hh"CLICK_DECLS/*=cKernelTap(ADDR/MASK [, GATEWAY, I<keywords> ETHER, MTU, HEADROOM, IGNORE_QUEUE_OVERFLOWS])=s comminterface to /dev/tap or ethertap (user-level)=dReads Ethernet packets from and writes Ethernet packets to a /dev/tun* or/dev/tap* device.  This allows a user-level Click to hand packets to thevirtual Ethernet device.  KernelTap will also transfer packets from thevirtual Ethernet device.KernelTap allocates a /dev/tun* or tap* device (this might fail) and runsifconfig(8) to set the interface's local (i.e., kernel) address to ADDR andthe netmask to MASK.  If a nonzero GATEWAY IP address (which must be on thesame network as the tun) is specified, then KernelTap tries to set up adefault route through that host.Keyword arguments are:=over 8=item ETHEREthernet address. Specifies the fake device's Ethernet address. Default is00:01:02:03:04:05. On Linux, you must supply an ETHER argument, and use thataddress as the destination Ethernet address for all packets sent to the tapelement; otherwise, Linux will ignore your packets. On FreeBSD, there is noway to set the Ethernet address, and any ETHER argument is silently ignored,but it is safe to use any destination Ethernet address for packets sent to thetap.=item MTUInteger.  The interface's maximum transmission unit, not including theEthernet header.  Default is 1500; some operating systems do not allow it tobe set.=item HEADROOMInteger.  The number of bytes left empty before the packet data (to leave roomfor additional encapsulation headers).  Default is 0.=item IGNORE_QUEUE_OVERFLOWSBoolean.  If true, don't print more than one error message when there arequeue overflow errors (ENOBUFS) when sending or receiving packets via the tundevice.  Default is false.=backKernelTap accepts the same arguments as KernelTun.=nLinux will send ARP queries to the fake device. You must respond to thesequeries in order to receive any IP packets, but you can obviously respondwith any Ethernet address you'd like. Here is one common idiom:  tap0 :: KernelTap(192.0.0.1/8)       -> fromhost_cl :: Classifier(12/0806, 12/0800);  fromhost_cl[0] -> ARPResponder(0.0.0.0/0 1:1:1:1:1:1) -> tap0;  fromhost_cl[1] -> ... // IP packetsAn error like "could not allocate a /dev/tap* device : No such file ordirectory" usually means that you have not enabled /dev/tap* in yourkernel.=a ToHost, KernelTun, ifconfig(8) */class KernelTap : public KernelTun { public:    KernelTap();    const char *class_name() const	{ return "KernelTap"; }};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -