5 * Email: k9982874@gmail.com
11 * This file implements the ipset module. It can handle packets by putting
12 * the A and AAAA addresses that are configured in unbound.conf as type
13 * ipset (local-zone statements) into a firewall rule IPSet. For firewall
14 * blacklist and whitelist usage.
16 * To use the IPset module, install the libmnl-dev (or libmnl-devel) package
17 * and configure with --enable-ipset. And compile. Then enable the ipset
18 * module in unbound.conf with module-config: "ipset validator iterator"
19 * then create it with ipset -N blacklist iphash and then add
20 * local-zone: "example.com." ipset
21 * statements for the zones where you want the addresses of the names
22 * looked up added to the set.
24 * Set the name of the set with
26 * name-v4: "blacklist"
27 * name-v6: "blacklist6"
28 * in unbound.conf. The set can be used in this way:
29 * iptables -A INPUT -m set --set blacklist src -j DROP
30 * ip6tables -A INPUT -m set --set blacklist6 src -j DROP
33 #include "util/module.h"
53 /** Init the ipset module */
54 int ipset_init(struct module_env* env, int id);
55 /** Deinit the ipset module */
56 void ipset_deinit(struct module_env* env, int id);
57 /** Operate on an event on a query (in qstate). */
58 void ipset_operate(struct module_qstate* qstate, enum module_ev event,
59 int id, struct outbound_entry* outbound);
60 /** Subordinate query done, inform this super request of its conclusion */
61 void ipset_inform_super(struct module_qstate* qstate, int id,
62 struct module_qstate* super);
63 /** clear the ipset query-specific contents out of qstate */
64 void ipset_clear(struct module_qstate* qstate, int id);
65 /** return memory estimate for ipset module */
66 size_t ipset_get_mem(struct module_env* env, int id);
69 * Get the function block with pointers to the ipset functions
70 * @return the function block for "ipset".
72 struct module_func_block* ipset_get_funcblock(void);