/**1* ipset.h2*3* Author: Kevin Chou4* Email: [email protected]5*/6#ifndef IPSET_H7#define IPSET_H8/** \file9*10* This file implements the ipset module. It can handle packets by putting11* the A and AAAA addresses that are configured in unbound.conf as type12* ipset (local-zone statements) into a firewall rule IPSet. For firewall13* blacklist and whitelist usage.14*15* To use the IPset module, install the libmnl-dev (or libmnl-devel) package16* and configure with --enable-ipset. And compile. Then enable the ipset17* module in unbound.conf with module-config: "ipset validator iterator"18* then create it with ipset -N blacklist iphash and then add19* local-zone: "example.com." ipset20* statements for the zones where you want the addresses of the names21* looked up added to the set.22*23* Set the name of the set with24* ipset:25* name-v4: "blacklist"26* name-v6: "blacklist6"27* in unbound.conf. The set can be used in this way:28* iptables -A INPUT -m set --set blacklist src -j DROP29* ip6tables -A INPUT -m set --set blacklist6 src -j DROP30*/3132#include "util/module.h"3334#ifdef __cplusplus35extern "C" {36#endif3738struct ipset_env {39void* dev;4041int v4_enabled;42int v6_enabled;4344const char *name_v4;45const char *name_v6;46};4748struct ipset_qstate {49int dummy;50};5152/** Startup the ipset module */53int ipset_startup(struct module_env* env, int id);54/** Destartup the ipset module */55void ipset_destartup(struct module_env* env, int id);56/** Init the ipset module */57int ipset_init(struct module_env* env, int id);58/** Deinit the ipset module */59void ipset_deinit(struct module_env* env, int id);60/** Operate on an event on a query (in qstate). */61void ipset_operate(struct module_qstate* qstate, enum module_ev event,62int id, struct outbound_entry* outbound);63/** Subordinate query done, inform this super request of its conclusion */64void ipset_inform_super(struct module_qstate* qstate, int id,65struct module_qstate* super);66/** clear the ipset query-specific contents out of qstate */67void ipset_clear(struct module_qstate* qstate, int id);68/** return memory estimate for ipset module */69size_t ipset_get_mem(struct module_env* env, int id);7071/**72* Get the function block with pointers to the ipset functions73* @return the function block for "ipset".74*/75struct module_func_block* ipset_get_funcblock(void);7677#ifdef __cplusplus78}79#endif8081#endif /* IPSET_H */82838485