8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9 #include <linux/module.h>
15 #include <linux/netfilter/x_tables.h>
19 static inline u32 nf_ct_orig_ipv4_src(
const struct nf_conn *
ct)
24 static inline const u32 *nf_ct_orig_ipv6_src(
const struct nf_conn *
ct)
42 xt_cluster_hash(
const struct nf_conn *ct,
47 switch(nf_ct_l3num(ct)) {
49 hash = xt_cluster_hash_ipv4(nf_ct_orig_ipv4_src(ct), info);
52 hash = xt_cluster_hash_ipv6(nf_ct_orig_ipv6_src(ct), info);
62 xt_cluster_ipv6_is_multicast(
const struct in6_addr *
addr)
65 return ((st &
htonl(0xFF000000)) ==
htonl(0xFF000000));
71 bool is_multicast =
false;
75 is_multicast = ipv4_is_multicast(ip_hdr(skb)->
daddr);
79 xt_cluster_ipv6_is_multicast(&ipv6_hdr(skb)->
daddr);
114 if (!xt_cluster_is_multicast_addr(skb, par->
family) &&
119 ct = nf_ct_get(skb, &ctinfo);
123 if (nf_ct_is_untracked(ct))
127 hash = xt_cluster_hash(ct->
master, info);
129 hash = xt_cluster_hash(ct, info);
135 static int xt_cluster_mt_checkentry(
const struct xt_mtchk_param *par)
140 pr_info(
"you have exceeded the maximum "
141 "number of cluster nodes (%u > %u)\n",
146 pr_info(
"this node mask cannot be "
147 "higher than the total number of nodes\n");
156 .match = xt_cluster_mt,
157 .checkentry = xt_cluster_mt_checkentry,
162 static int __init xt_cluster_mt_init(
void)
167 static void __exit xt_cluster_mt_fini(
void)