📄 kernelfilter.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_KERNELFILTER_HH#define CLICK_KERNELFILTER_HH#include <click/element.hh>CLICK_DECLS/*=cKernelFilter(FILTERSPEC, ...)=s commblock kernel from handling packets=dThe KernelFilter element installs filter rules in the kernel to stop thekernel from handling certain types of packets. Use this in combination withFromDevice.u to handle packets in user-level Click configurations.KernelFilter uses iptables(1) to install filters; if your system does notsupport iptables(1), KernelFilter will fail.KernelFilter uninstalls its firewall rules when Click shuts down. If Clickshuts down uncleanly, for instance because of a segmentation fault or 'kill-9', then the rules will remain in place, and you'll have to remove themyourself.Currently only one form of FILTERSPEC is understood.=over 8=item 'C<drop dev DEVNAME>'The kernel is blocked from handling any packets arriving on device DEVNAME.However, these packets will still be visible to tcpdump(1), and to Clickelements like FromDevice.u.=back=aFromDevice.u, ToDevice.u, KernelTap, ifconfig(8) */class KernelFilter : public Element { public: enum ConfigurePhase { CONFIGURE_PHASE_FROMDEVICE = CONFIGURE_PHASE_PRIVILEGED - 1, CONFIGURE_PHASE_TODEVICE = CONFIGURE_PHASE_FROMDEVICE + 1, CONFIGURE_PHASE_KERNELFILTER = CONFIGURE_PHASE_FROMDEVICE + 1 }; KernelFilter(); ~KernelFilter(); const char *class_name() const { return "KernelFilter"; } const char *port_count() const { return PORTS_0_0; } int configure_phase() const { return CONFIGURE_PHASE_KERNELFILTER; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); static int device_filter(const String &devname, bool add_filter, ErrorHandler *errh); private: Vector<String> _drop_devices;};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -