Commit d3c5ee6d authored by Jan Engelhardt's avatar Jan Engelhardt Committed by David S. Miller

[NETFILTER]: x_tables: consistent and unique symbol names

Give all Netfilter modules consistent and unique symbol names.
Signed-off-by: default avatarJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c610979
...@@ -287,12 +287,9 @@ clusterip_responsible(const struct clusterip_config *config, u_int32_t hash) ...@@ -287,12 +287,9 @@ clusterip_responsible(const struct clusterip_config *config, u_int32_t hash)
***********************************************************************/ ***********************************************************************/
static unsigned int static unsigned int
target(struct sk_buff *skb, clusterip_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct ipt_clusterip_tgt_info *cipinfo = targinfo; const struct ipt_clusterip_tgt_info *cipinfo = targinfo;
struct nf_conn *ct; struct nf_conn *ct;
...@@ -359,11 +356,9 @@ target(struct sk_buff *skb, ...@@ -359,11 +356,9 @@ target(struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, clusterip_tg_check(const char *tablename, const void *e_void,
const void *e_void, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
struct ipt_clusterip_tgt_info *cipinfo = targinfo; struct ipt_clusterip_tgt_info *cipinfo = targinfo;
const struct ipt_entry *e = e_void; const struct ipt_entry *e = e_void;
...@@ -427,7 +422,7 @@ checkentry(const char *tablename, ...@@ -427,7 +422,7 @@ checkentry(const char *tablename,
} }
/* drop reference count of cluster config when rule is deleted */ /* drop reference count of cluster config when rule is deleted */
static void destroy(const struct xt_target *target, void *targinfo) static void clusterip_tg_destroy(const struct xt_target *target, void *targinfo)
{ {
struct ipt_clusterip_tgt_info *cipinfo = targinfo; struct ipt_clusterip_tgt_info *cipinfo = targinfo;
...@@ -454,12 +449,12 @@ struct compat_ipt_clusterip_tgt_info ...@@ -454,12 +449,12 @@ struct compat_ipt_clusterip_tgt_info
}; };
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_target clusterip_tgt __read_mostly = { static struct xt_target clusterip_tg_reg __read_mostly = {
.name = "CLUSTERIP", .name = "CLUSTERIP",
.family = AF_INET, .family = AF_INET,
.target = target, .target = clusterip_tg,
.checkentry = checkentry, .checkentry = clusterip_tg_check,
.destroy = destroy, .destroy = clusterip_tg_destroy,
.targetsize = sizeof(struct ipt_clusterip_tgt_info), .targetsize = sizeof(struct ipt_clusterip_tgt_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_ipt_clusterip_tgt_info), .compatsize = sizeof(struct compat_ipt_clusterip_tgt_info),
...@@ -712,11 +707,11 @@ static const struct file_operations clusterip_proc_fops = { ...@@ -712,11 +707,11 @@ static const struct file_operations clusterip_proc_fops = {
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static int __init ipt_clusterip_init(void) static int __init clusterip_tg_init(void)
{ {
int ret; int ret;
ret = xt_register_target(&clusterip_tgt); ret = xt_register_target(&clusterip_tg_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -742,11 +737,11 @@ static int __init ipt_clusterip_init(void) ...@@ -742,11 +737,11 @@ static int __init ipt_clusterip_init(void)
nf_unregister_hook(&cip_arp_ops); nf_unregister_hook(&cip_arp_ops);
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
cleanup_target: cleanup_target:
xt_unregister_target(&clusterip_tgt); xt_unregister_target(&clusterip_tg_reg);
return ret; return ret;
} }
static void __exit ipt_clusterip_fini(void) static void __exit clusterip_tg_exit(void)
{ {
printk(KERN_NOTICE "ClusterIP Version %s unloading\n", printk(KERN_NOTICE "ClusterIP Version %s unloading\n",
CLUSTERIP_VERSION); CLUSTERIP_VERSION);
...@@ -754,8 +749,8 @@ static void __exit ipt_clusterip_fini(void) ...@@ -754,8 +749,8 @@ static void __exit ipt_clusterip_fini(void)
remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent); remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent);
#endif #endif
nf_unregister_hook(&cip_arp_ops); nf_unregister_hook(&cip_arp_ops);
xt_unregister_target(&clusterip_tgt); xt_unregister_target(&clusterip_tg_reg);
} }
module_init(ipt_clusterip_init); module_init(clusterip_tg_init);
module_exit(ipt_clusterip_fini); module_exit(clusterip_tg_exit);
...@@ -77,12 +77,9 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo) ...@@ -77,12 +77,9 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
} }
static unsigned int static unsigned int
target(struct sk_buff *skb, ecn_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct ipt_ECN_info *einfo = targinfo; const struct ipt_ECN_info *einfo = targinfo;
...@@ -99,11 +96,9 @@ target(struct sk_buff *skb, ...@@ -99,11 +96,9 @@ target(struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, ecn_tg_check(const char *tablename, const void *e_void,
const void *e_void, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct ipt_ECN_info *einfo = (struct ipt_ECN_info *)targinfo; const struct ipt_ECN_info *einfo = (struct ipt_ECN_info *)targinfo;
const struct ipt_entry *e = e_void; const struct ipt_entry *e = e_void;
...@@ -127,25 +122,25 @@ checkentry(const char *tablename, ...@@ -127,25 +122,25 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ipt_ecn_reg __read_mostly = { static struct xt_target ecn_tg_reg __read_mostly = {
.name = "ECN", .name = "ECN",
.family = AF_INET, .family = AF_INET,
.target = target, .target = ecn_tg,
.targetsize = sizeof(struct ipt_ECN_info), .targetsize = sizeof(struct ipt_ECN_info),
.table = "mangle", .table = "mangle",
.checkentry = checkentry, .checkentry = ecn_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ecn_init(void) static int __init ecn_tg_init(void)
{ {
return xt_register_target(&ipt_ecn_reg); return xt_register_target(&ecn_tg_reg);
} }
static void __exit ipt_ecn_fini(void) static void __exit ecn_tg_exit(void)
{ {
xt_unregister_target(&ipt_ecn_reg); xt_unregister_target(&ecn_tg_reg);
} }
module_init(ipt_ecn_init); module_init(ecn_tg_init);
module_exit(ipt_ecn_fini); module_exit(ecn_tg_exit);
...@@ -418,12 +418,9 @@ ipt_log_packet(unsigned int pf, ...@@ -418,12 +418,9 @@ ipt_log_packet(unsigned int pf,
} }
static unsigned int static unsigned int
ipt_log_target(struct sk_buff *skb, log_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct ipt_log_info *loginfo = targinfo; const struct ipt_log_info *loginfo = targinfo;
struct nf_loginfo li; struct nf_loginfo li;
...@@ -437,11 +434,10 @@ ipt_log_target(struct sk_buff *skb, ...@@ -437,11 +434,10 @@ ipt_log_target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool ipt_log_checkentry(const char *tablename, static bool
const void *e, log_tg_check(const char *tablename, const void *e,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ipt_log_info *loginfo = targinfo; const struct ipt_log_info *loginfo = targinfo;
...@@ -457,12 +453,12 @@ static bool ipt_log_checkentry(const char *tablename, ...@@ -457,12 +453,12 @@ static bool ipt_log_checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ipt_log_reg __read_mostly = { static struct xt_target log_tg_reg __read_mostly = {
.name = "LOG", .name = "LOG",
.family = AF_INET, .family = AF_INET,
.target = ipt_log_target, .target = log_tg,
.targetsize = sizeof(struct ipt_log_info), .targetsize = sizeof(struct ipt_log_info),
.checkentry = ipt_log_checkentry, .checkentry = log_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
...@@ -472,22 +468,22 @@ static struct nf_logger ipt_log_logger ={ ...@@ -472,22 +468,22 @@ static struct nf_logger ipt_log_logger ={
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_log_init(void) static int __init log_tg_init(void)
{ {
int ret; int ret;
ret = xt_register_target(&ipt_log_reg); ret = xt_register_target(&log_tg_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
nf_log_register(PF_INET, &ipt_log_logger); nf_log_register(PF_INET, &ipt_log_logger);
return 0; return 0;
} }
static void __exit ipt_log_fini(void) static void __exit log_tg_exit(void)
{ {
nf_log_unregister(&ipt_log_logger); nf_log_unregister(&ipt_log_logger);
xt_unregister_target(&ipt_log_reg); xt_unregister_target(&log_tg_reg);
} }
module_init(ipt_log_init); module_init(log_tg_init);
module_exit(ipt_log_fini); module_exit(log_tg_exit);
...@@ -32,11 +32,9 @@ static DEFINE_RWLOCK(masq_lock); ...@@ -32,11 +32,9 @@ static DEFINE_RWLOCK(masq_lock);
/* FIXME: Multiple targets. --RR */ /* FIXME: Multiple targets. --RR */
static bool static bool
masquerade_check(const char *tablename, masquerade_tg_check(const char *tablename, const void *e,
const void *e, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct nf_nat_multi_range_compat *mr = targinfo; const struct nf_nat_multi_range_compat *mr = targinfo;
...@@ -52,12 +50,9 @@ masquerade_check(const char *tablename, ...@@ -52,12 +50,9 @@ masquerade_check(const char *tablename,
} }
static unsigned int static unsigned int
masquerade_target(struct sk_buff *skb, masquerade_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct nf_conn *ct; struct nf_conn *ct;
struct nf_conn_nat *nat; struct nf_conn_nat *nat;
...@@ -166,22 +161,22 @@ static struct notifier_block masq_inet_notifier = { ...@@ -166,22 +161,22 @@ static struct notifier_block masq_inet_notifier = {
.notifier_call = masq_inet_event, .notifier_call = masq_inet_event,
}; };
static struct xt_target masquerade __read_mostly = { static struct xt_target masquerade_tg_reg __read_mostly = {
.name = "MASQUERADE", .name = "MASQUERADE",
.family = AF_INET, .family = AF_INET,
.target = masquerade_target, .target = masquerade_tg,
.targetsize = sizeof(struct nf_nat_multi_range_compat), .targetsize = sizeof(struct nf_nat_multi_range_compat),
.table = "nat", .table = "nat",
.hooks = 1 << NF_INET_POST_ROUTING, .hooks = 1 << NF_INET_POST_ROUTING,
.checkentry = masquerade_check, .checkentry = masquerade_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_masquerade_init(void) static int __init masquerade_tg_init(void)
{ {
int ret; int ret;
ret = xt_register_target(&masquerade); ret = xt_register_target(&masquerade_tg_reg);
if (ret == 0) { if (ret == 0) {
/* Register for device down reports */ /* Register for device down reports */
...@@ -193,12 +188,12 @@ static int __init ipt_masquerade_init(void) ...@@ -193,12 +188,12 @@ static int __init ipt_masquerade_init(void)
return ret; return ret;
} }
static void __exit ipt_masquerade_fini(void) static void __exit masquerade_tg_exit(void)
{ {
xt_unregister_target(&masquerade); xt_unregister_target(&masquerade_tg_reg);
unregister_netdevice_notifier(&masq_dev_notifier); unregister_netdevice_notifier(&masq_dev_notifier);
unregister_inetaddr_notifier(&masq_inet_notifier); unregister_inetaddr_notifier(&masq_inet_notifier);
} }
module_init(ipt_masquerade_init); module_init(masquerade_tg_init);
module_exit(ipt_masquerade_fini); module_exit(masquerade_tg_exit);
...@@ -23,11 +23,9 @@ MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>"); ...@@ -23,11 +23,9 @@ MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>");
MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target"); MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target");
static bool static bool
check(const char *tablename, netmap_tg_check(const char *tablename, const void *e,
const void *e, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct nf_nat_multi_range_compat *mr = targinfo; const struct nf_nat_multi_range_compat *mr = targinfo;
...@@ -43,12 +41,9 @@ check(const char *tablename, ...@@ -43,12 +41,9 @@ check(const char *tablename,
} }
static unsigned int static unsigned int
target(struct sk_buff *skb, netmap_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct nf_conn *ct; struct nf_conn *ct;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
...@@ -78,28 +73,28 @@ target(struct sk_buff *skb, ...@@ -78,28 +73,28 @@ target(struct sk_buff *skb,
return nf_nat_setup_info(ct, &newrange, hooknum); return nf_nat_setup_info(ct, &newrange, hooknum);
} }
static struct xt_target target_module __read_mostly = { static struct xt_target netmap_tg_reg __read_mostly = {
.name = "NETMAP", .name = "NETMAP",
.family = AF_INET, .family = AF_INET,
.target = target, .target = netmap_tg,
.targetsize = sizeof(struct nf_nat_multi_range_compat), .targetsize = sizeof(struct nf_nat_multi_range_compat),
.table = "nat", .table = "nat",
.hooks = (1 << NF_INET_PRE_ROUTING) | .hooks = (1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_POST_ROUTING) | (1 << NF_INET_POST_ROUTING) |
(1 << NF_INET_LOCAL_OUT), (1 << NF_INET_LOCAL_OUT),
.checkentry = check, .checkentry = netmap_tg_check,
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ipt_netmap_init(void) static int __init netmap_tg_init(void)
{ {
return xt_register_target(&target_module); return xt_register_target(&netmap_tg_reg);
} }
static void __exit ipt_netmap_fini(void) static void __exit netmap_tg_exit(void)
{ {
xt_unregister_target(&target_module); xt_unregister_target(&netmap_tg_reg);
} }
module_init(ipt_netmap_init); module_init(netmap_tg_init);
module_exit(ipt_netmap_fini); module_exit(netmap_tg_exit);
...@@ -27,11 +27,9 @@ MODULE_DESCRIPTION("iptables REDIRECT target module"); ...@@ -27,11 +27,9 @@ MODULE_DESCRIPTION("iptables REDIRECT target module");
/* FIXME: Take multiple ranges --RR */ /* FIXME: Take multiple ranges --RR */
static bool static bool
redirect_check(const char *tablename, redirect_tg_check(const char *tablename, const void *e,
const void *e, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct nf_nat_multi_range_compat *mr = targinfo; const struct nf_nat_multi_range_compat *mr = targinfo;
...@@ -47,12 +45,9 @@ redirect_check(const char *tablename, ...@@ -47,12 +45,9 @@ redirect_check(const char *tablename,
} }
static unsigned int static unsigned int
redirect_target(struct sk_buff *skb, redirect_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct nf_conn *ct; struct nf_conn *ct;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
...@@ -95,26 +90,26 @@ redirect_target(struct sk_buff *skb, ...@@ -95,26 +90,26 @@ redirect_target(struct sk_buff *skb,
return nf_nat_setup_info(ct, &newrange, hooknum); return nf_nat_setup_info(ct, &newrange, hooknum);
} }
static struct xt_target redirect_reg __read_mostly = { static struct xt_target redirect_tg_reg __read_mostly = {
.name = "REDIRECT", .name = "REDIRECT",
.family = AF_INET, .family = AF_INET,
.target = redirect_target, .target = redirect_tg,
.targetsize = sizeof(struct nf_nat_multi_range_compat), .targetsize = sizeof(struct nf_nat_multi_range_compat),
.table = "nat", .table = "nat",
.hooks = (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_OUT), .hooks = (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_OUT),
.checkentry = redirect_check, .checkentry = redirect_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_redirect_init(void) static int __init redirect_tg_init(void)
{ {
return xt_register_target(&redirect_reg); return xt_register_target(&redirect_tg_reg);
} }
static void __exit ipt_redirect_fini(void) static void __exit redirect_tg_exit(void)
{ {
xt_unregister_target(&redirect_reg); xt_unregister_target(&redirect_tg_reg);
} }
module_init(ipt_redirect_init); module_init(redirect_tg_init);
module_exit(ipt_redirect_fini); module_exit(redirect_tg_exit);
...@@ -156,12 +156,10 @@ static inline void send_unreach(struct sk_buff *skb_in, int code) ...@@ -156,12 +156,10 @@ static inline void send_unreach(struct sk_buff *skb_in, int code)
icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0); icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
} }
static unsigned int reject(struct sk_buff *skb, static unsigned int
const struct net_device *in, reject_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
const struct ipt_reject_info *reject = targinfo; const struct ipt_reject_info *reject = targinfo;
...@@ -205,11 +203,10 @@ static unsigned int reject(struct sk_buff *skb, ...@@ -205,11 +203,10 @@ static unsigned int reject(struct sk_buff *skb,
return NF_DROP; return NF_DROP;
} }
static bool check(const char *tablename, static bool
const void *e_void, reject_tg_check(const char *tablename, const void *e_void,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ipt_reject_info *rejinfo = targinfo; const struct ipt_reject_info *rejinfo = targinfo;
const struct ipt_entry *e = e_void; const struct ipt_entry *e = e_void;
...@@ -228,27 +225,27 @@ static bool check(const char *tablename, ...@@ -228,27 +225,27 @@ static bool check(const char *tablename,
return true; return true;
} }
static struct xt_target ipt_reject_reg __read_mostly = { static struct xt_target reject_tg_reg __read_mostly = {
.name = "REJECT", .name = "REJECT",
.family = AF_INET, .family = AF_INET,
.target = reject, .target = reject_tg,
.targetsize = sizeof(struct ipt_reject_info), .targetsize = sizeof(struct ipt_reject_info),
.table = "filter", .table = "filter",
.hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD) | .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD) |
(1 << NF_INET_LOCAL_OUT), (1 << NF_INET_LOCAL_OUT),
.checkentry = check, .checkentry = reject_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_reject_init(void) static int __init reject_tg_init(void)
{ {
return xt_register_target(&ipt_reject_reg); return xt_register_target(&reject_tg_reg);
} }
static void __exit ipt_reject_fini(void) static void __exit reject_tg_exit(void)
{ {
xt_unregister_target(&ipt_reject_reg); xt_unregister_target(&reject_tg_reg);
} }
module_init(ipt_reject_init); module_init(reject_tg_init);
module_exit(ipt_reject_fini); module_exit(reject_tg_exit);
...@@ -28,11 +28,9 @@ MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>"); ...@@ -28,11 +28,9 @@ MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>");
MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip"); MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip");
static bool static bool
same_check(const char *tablename, same_tg_check(const char *tablename, const void *e,
const void *e, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
unsigned int count, countess, rangeip, index = 0; unsigned int count, countess, rangeip, index = 0;
struct ipt_same_info *mr = targinfo; struct ipt_same_info *mr = targinfo;
...@@ -92,8 +90,7 @@ same_check(const char *tablename, ...@@ -92,8 +90,7 @@ same_check(const char *tablename,
return true; return true;
} }
static void static void same_tg_destroy(const struct xt_target *target, void *targinfo)
same_destroy(const struct xt_target *target, void *targinfo)
{ {
struct ipt_same_info *mr = targinfo; struct ipt_same_info *mr = targinfo;
...@@ -104,12 +101,9 @@ same_destroy(const struct xt_target *target, void *targinfo) ...@@ -104,12 +101,9 @@ same_destroy(const struct xt_target *target, void *targinfo)
} }
static unsigned int static unsigned int
same_target(struct sk_buff *skb, same_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct nf_conn *ct; struct nf_conn *ct;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
...@@ -152,29 +146,29 @@ same_target(struct sk_buff *skb, ...@@ -152,29 +146,29 @@ same_target(struct sk_buff *skb,
return nf_nat_setup_info(ct, &newrange, hooknum); return nf_nat_setup_info(ct, &newrange, hooknum);
} }
static struct xt_target same_reg __read_mostly = { static struct xt_target same_tg_reg __read_mostly = {
.name = "SAME", .name = "SAME",
.family = AF_INET, .family = AF_INET,
.target = same_target, .target = same_tg,
.targetsize = sizeof(struct ipt_same_info), .targetsize = sizeof(struct ipt_same_info),
.table = "nat", .table = "nat",
.hooks = (1 << NF_INET_PRE_ROUTING) | .hooks = (1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_POST_ROUTING), (1 << NF_INET_POST_ROUTING),
.checkentry = same_check, .checkentry = same_tg_check,
.destroy = same_destroy, .destroy = same_tg_destroy,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_same_init(void) static int __init same_tg_init(void)
{ {
return xt_register_target(&same_reg); return xt_register_target(&same_tg_reg);
} }
static void __exit ipt_same_fini(void) static void __exit same_tg_exit(void)
{ {
xt_unregister_target(&same_reg); xt_unregister_target(&same_tg_reg);
} }
module_init(ipt_same_init); module_init(same_tg_init);
module_exit(ipt_same_fini); module_exit(same_tg_exit);
...@@ -21,12 +21,9 @@ MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); ...@@ -21,12 +21,9 @@ MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
MODULE_DESCRIPTION("iptables TOS mangling module"); MODULE_DESCRIPTION("iptables TOS mangling module");
static unsigned int static unsigned int
target(struct sk_buff *skb, tos_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct ipt_tos_target_info *tosinfo = targinfo; const struct ipt_tos_target_info *tosinfo = targinfo;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
...@@ -44,11 +41,9 @@ target(struct sk_buff *skb, ...@@ -44,11 +41,9 @@ target(struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, tos_tg_check(const char *tablename, const void *e_void,
const void *e_void, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const u_int8_t tos = ((struct ipt_tos_target_info *)targinfo)->tos; const u_int8_t tos = ((struct ipt_tos_target_info *)targinfo)->tos;
...@@ -63,25 +58,25 @@ checkentry(const char *tablename, ...@@ -63,25 +58,25 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ipt_tos_reg __read_mostly = { static struct xt_target tos_tg_reg __read_mostly = {
.name = "TOS", .name = "TOS",
.family = AF_INET, .family = AF_INET,
.target = target, .target = tos_tg,
.targetsize = sizeof(struct ipt_tos_target_info), .targetsize = sizeof(struct ipt_tos_target_info),
.table = "mangle", .table = "mangle",
.checkentry = checkentry, .checkentry = tos_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_tos_init(void) static int __init tos_tg_init(void)
{ {
return xt_register_target(&ipt_tos_reg); return xt_register_target(&tos_tg_reg);
} }
static void __exit ipt_tos_fini(void) static void __exit tos_tg_exit(void)
{ {
xt_unregister_target(&ipt_tos_reg); xt_unregister_target(&tos_tg_reg);
} }
module_init(ipt_tos_init); module_init(tos_tg_init);
module_exit(ipt_tos_fini); module_exit(tos_tg_exit);
...@@ -20,10 +20,9 @@ MODULE_DESCRIPTION("IP tables TTL modification module"); ...@@ -20,10 +20,9 @@ MODULE_DESCRIPTION("IP tables TTL modification module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static unsigned int static unsigned int
ipt_ttl_target(struct sk_buff *skb, ttl_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const struct xt_target *target, const void *targinfo)
const void *targinfo)
{ {
struct iphdr *iph; struct iphdr *iph;
const struct ipt_TTL_info *info = targinfo; const struct ipt_TTL_info *info = targinfo;
...@@ -62,11 +61,10 @@ ipt_ttl_target(struct sk_buff *skb, ...@@ -62,11 +61,10 @@ ipt_ttl_target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool ipt_ttl_checkentry(const char *tablename, static bool
const void *e, ttl_tg_check(const char *tablename, const void *e,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ipt_TTL_info *info = targinfo; const struct ipt_TTL_info *info = targinfo;
...@@ -80,25 +78,25 @@ static bool ipt_ttl_checkentry(const char *tablename, ...@@ -80,25 +78,25 @@ static bool ipt_ttl_checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ipt_TTL __read_mostly = { static struct xt_target ttl_tg_reg __read_mostly = {
.name = "TTL", .name = "TTL",
.family = AF_INET, .family = AF_INET,
.target = ipt_ttl_target, .target = ttl_tg,
.targetsize = sizeof(struct ipt_TTL_info), .targetsize = sizeof(struct ipt_TTL_info),
.table = "mangle", .table = "mangle",
.checkentry = ipt_ttl_checkentry, .checkentry = ttl_tg_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ttl_init(void) static int __init ttl_tg_init(void)
{ {
return xt_register_target(&ipt_TTL); return xt_register_target(&ttl_tg_reg);
} }
static void __exit ipt_ttl_fini(void) static void __exit ttl_tg_exit(void)
{ {
xt_unregister_target(&ipt_TTL); xt_unregister_target(&ttl_tg_reg);
} }
module_init(ipt_ttl_init); module_init(ttl_tg_init);
module_exit(ipt_ttl_fini); module_exit(ttl_tg_exit);
...@@ -279,12 +279,10 @@ static void ipt_ulog_packet(unsigned int hooknum, ...@@ -279,12 +279,10 @@ static void ipt_ulog_packet(unsigned int hooknum,
spin_unlock_bh(&ulog_lock); spin_unlock_bh(&ulog_lock);
} }
static unsigned int ipt_ulog_target(struct sk_buff *skb, static unsigned int
const struct net_device *in, ulog_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo;
...@@ -318,11 +316,10 @@ static void ipt_logfn(unsigned int pf, ...@@ -318,11 +316,10 @@ static void ipt_logfn(unsigned int pf,
ipt_ulog_packet(hooknum, skb, in, out, &loginfo, prefix); ipt_ulog_packet(hooknum, skb, in, out, &loginfo, prefix);
} }
static bool ipt_ulog_checkentry(const char *tablename, static bool
const void *e, ulog_tg_check(const char *tablename, const void *e,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hookmask)
unsigned int hookmask)
{ {
const struct ipt_ulog_info *loginfo = targinfo; const struct ipt_ulog_info *loginfo = targinfo;
...@@ -347,7 +344,7 @@ struct compat_ipt_ulog_info { ...@@ -347,7 +344,7 @@ struct compat_ipt_ulog_info {
char prefix[ULOG_PREFIX_LEN]; char prefix[ULOG_PREFIX_LEN];
}; };
static void compat_from_user(void *dst, void *src) static void ulog_tg_compat_from_user(void *dst, void *src)
{ {
const struct compat_ipt_ulog_info *cl = src; const struct compat_ipt_ulog_info *cl = src;
struct ipt_ulog_info l = { struct ipt_ulog_info l = {
...@@ -360,7 +357,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -360,7 +357,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &l, sizeof(l)); memcpy(dst, &l, sizeof(l));
} }
static int compat_to_user(void __user *dst, void *src) static int ulog_tg_compat_to_user(void __user *dst, void *src)
{ {
const struct ipt_ulog_info *l = src; const struct ipt_ulog_info *l = src;
struct compat_ipt_ulog_info cl = { struct compat_ipt_ulog_info cl = {
...@@ -374,16 +371,16 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -374,16 +371,16 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_target ipt_ulog_reg __read_mostly = { static struct xt_target ulog_tg_reg __read_mostly = {
.name = "ULOG", .name = "ULOG",
.family = AF_INET, .family = AF_INET,
.target = ipt_ulog_target, .target = ulog_tg,
.targetsize = sizeof(struct ipt_ulog_info), .targetsize = sizeof(struct ipt_ulog_info),
.checkentry = ipt_ulog_checkentry, .checkentry = ulog_tg_check,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_ipt_ulog_info), .compatsize = sizeof(struct compat_ipt_ulog_info),
.compat_from_user = compat_from_user, .compat_from_user = ulog_tg_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = ulog_tg_compat_to_user,
#endif #endif
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
...@@ -394,7 +391,7 @@ static struct nf_logger ipt_ulog_logger = { ...@@ -394,7 +391,7 @@ static struct nf_logger ipt_ulog_logger = {
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ulog_init(void) static int __init ulog_tg_init(void)
{ {
int ret, i; int ret, i;
...@@ -415,7 +412,7 @@ static int __init ipt_ulog_init(void) ...@@ -415,7 +412,7 @@ static int __init ipt_ulog_init(void)
if (!nflognl) if (!nflognl)
return -ENOMEM; return -ENOMEM;
ret = xt_register_target(&ipt_ulog_reg); ret = xt_register_target(&ulog_tg_reg);
if (ret < 0) { if (ret < 0) {
sock_release(nflognl->sk_socket); sock_release(nflognl->sk_socket);
return ret; return ret;
...@@ -426,7 +423,7 @@ static int __init ipt_ulog_init(void) ...@@ -426,7 +423,7 @@ static int __init ipt_ulog_init(void)
return 0; return 0;
} }
static void __exit ipt_ulog_fini(void) static void __exit ulog_tg_exit(void)
{ {
ulog_buff_t *ub; ulog_buff_t *ub;
int i; int i;
...@@ -435,7 +432,7 @@ static void __exit ipt_ulog_fini(void) ...@@ -435,7 +432,7 @@ static void __exit ipt_ulog_fini(void)
if (nflog) if (nflog)
nf_log_unregister(&ipt_ulog_logger); nf_log_unregister(&ipt_ulog_logger);
xt_unregister_target(&ipt_ulog_reg); xt_unregister_target(&ulog_tg_reg);
sock_release(nflognl->sk_socket); sock_release(nflognl->sk_socket);
/* remove pending timers and free allocated skb's */ /* remove pending timers and free allocated skb's */
...@@ -453,5 +450,5 @@ static void __exit ipt_ulog_fini(void) ...@@ -453,5 +450,5 @@ static void __exit ipt_ulog_fini(void)
} }
} }
module_init(ipt_ulog_init); module_init(ulog_tg_init);
module_exit(ipt_ulog_fini); module_exit(ulog_tg_exit);
...@@ -27,10 +27,11 @@ static inline bool match_type(__be32 addr, u_int16_t mask) ...@@ -27,10 +27,11 @@ static inline bool match_type(__be32 addr, u_int16_t mask)
return !!(mask & (1 << inet_addr_type(addr))); return !!(mask & (1 << inet_addr_type(addr)));
} }
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, const struct net_device *out, addrtype_mt(const struct sk_buff *skb, const struct net_device *in,
const struct xt_match *match, const void *matchinfo, const struct net_device *out, const struct xt_match *match,
int offset, unsigned int protoff, bool *hotdrop) const void *matchinfo, int offset, unsigned int protoff,
bool *hotdrop)
{ {
const struct ipt_addrtype_info *info = matchinfo; const struct ipt_addrtype_info *info = matchinfo;
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
...@@ -44,23 +45,23 @@ static bool match(const struct sk_buff *skb, ...@@ -44,23 +45,23 @@ static bool match(const struct sk_buff *skb,
return ret; return ret;
} }
static struct xt_match addrtype_match __read_mostly = { static struct xt_match addrtype_mt_reg __read_mostly = {
.name = "addrtype", .name = "addrtype",
.family = AF_INET, .family = AF_INET,
.match = match, .match = addrtype_mt,
.matchsize = sizeof(struct ipt_addrtype_info), .matchsize = sizeof(struct ipt_addrtype_info),
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ipt_addrtype_init(void) static int __init addrtype_mt_init(void)
{ {
return xt_register_match(&addrtype_match); return xt_register_match(&addrtype_mt_reg);
} }
static void __exit ipt_addrtype_fini(void) static void __exit addrtype_mt_exit(void)
{ {
xt_unregister_match(&addrtype_match); xt_unregister_match(&addrtype_mt_reg);
} }
module_init(ipt_addrtype_init); module_init(addrtype_mt_init);
module_exit(ipt_addrtype_fini); module_exit(addrtype_mt_exit);
...@@ -37,14 +37,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) ...@@ -37,14 +37,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, ah_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ip_auth_hdr _ahdr; struct ip_auth_hdr _ahdr;
const struct ip_auth_hdr *ah; const struct ip_auth_hdr *ah;
...@@ -72,11 +67,9 @@ match(const struct sk_buff *skb, ...@@ -72,11 +67,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, ah_mt_check(const char *tablename, const void *ip_void,
const void *ip_void, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ipt_ah *ahinfo = matchinfo; const struct ipt_ah *ahinfo = matchinfo;
...@@ -88,25 +81,25 @@ checkentry(const char *tablename, ...@@ -88,25 +81,25 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match ah_match __read_mostly = { static struct xt_match ah_mt_reg __read_mostly = {
.name = "ah", .name = "ah",
.family = AF_INET, .family = AF_INET,
.match = match, .match = ah_mt,
.matchsize = sizeof(struct ipt_ah), .matchsize = sizeof(struct ipt_ah),
.proto = IPPROTO_AH, .proto = IPPROTO_AH,
.checkentry = checkentry, .checkentry = ah_mt_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ah_init(void) static int __init ah_mt_init(void)
{ {
return xt_register_match(&ah_match); return xt_register_match(&ah_mt_reg);
} }
static void __exit ipt_ah_fini(void) static void __exit ah_mt_exit(void)
{ {
xt_unregister_match(&ah_match); xt_unregister_match(&ah_mt_reg);
} }
module_init(ipt_ah_init); module_init(ah_mt_init);
module_exit(ipt_ah_fini); module_exit(ah_mt_exit);
...@@ -67,10 +67,10 @@ static inline bool match_tcp(const struct sk_buff *skb, ...@@ -67,10 +67,10 @@ static inline bool match_tcp(const struct sk_buff *skb,
return true; return true;
} }
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, const struct net_device *out, ecn_mt(const struct sk_buff *skb, const struct net_device *in,
const struct xt_match *match, const void *matchinfo, const struct net_device *out, const struct xt_match *match,
int offset, unsigned int protoff, bool *hotdrop) const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
{ {
const struct ipt_ecn_info *info = matchinfo; const struct ipt_ecn_info *info = matchinfo;
...@@ -88,9 +88,10 @@ static bool match(const struct sk_buff *skb, ...@@ -88,9 +88,10 @@ static bool match(const struct sk_buff *skb,
return true; return true;
} }
static bool checkentry(const char *tablename, const void *ip_void, static bool
const struct xt_match *match, ecn_mt_check(const char *tablename, const void *ip_void,
void *matchinfo, unsigned int hook_mask) const struct xt_match *match, void *matchinfo,
unsigned int hook_mask)
{ {
const struct ipt_ecn_info *info = matchinfo; const struct ipt_ecn_info *info = matchinfo;
const struct ipt_ip *ip = ip_void; const struct ipt_ip *ip = ip_void;
...@@ -111,24 +112,24 @@ static bool checkentry(const char *tablename, const void *ip_void, ...@@ -111,24 +112,24 @@ static bool checkentry(const char *tablename, const void *ip_void,
return true; return true;
} }
static struct xt_match ecn_match __read_mostly = { static struct xt_match ecn_mt_reg __read_mostly = {
.name = "ecn", .name = "ecn",
.family = AF_INET, .family = AF_INET,
.match = match, .match = ecn_mt,
.matchsize = sizeof(struct ipt_ecn_info), .matchsize = sizeof(struct ipt_ecn_info),
.checkentry = checkentry, .checkentry = ecn_mt_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ecn_init(void) static int __init ecn_mt_init(void)
{ {
return xt_register_match(&ecn_match); return xt_register_match(&ecn_mt_reg);
} }
static void __exit ipt_ecn_fini(void) static void __exit ecn_mt_exit(void)
{ {
xt_unregister_match(&ecn_match); xt_unregister_match(&ecn_mt_reg);
} }
module_init(ipt_ecn_init); module_init(ecn_mt_init);
module_exit(ipt_ecn_fini); module_exit(ecn_mt_exit);
...@@ -18,12 +18,10 @@ MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); ...@@ -18,12 +18,10 @@ MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
MODULE_DESCRIPTION("iptables arbitrary IP range match module"); MODULE_DESCRIPTION("iptables arbitrary IP range match module");
static bool static bool
match(const struct sk_buff *skb, iprange_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset, unsigned int protoff, bool *hotdrop)
{ {
const struct ipt_iprange_info *info = matchinfo; const struct ipt_iprange_info *info = matchinfo;
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
...@@ -57,23 +55,23 @@ match(const struct sk_buff *skb, ...@@ -57,23 +55,23 @@ match(const struct sk_buff *skb,
return true; return true;
} }
static struct xt_match iprange_match __read_mostly = { static struct xt_match iprange_mt_reg __read_mostly = {
.name = "iprange", .name = "iprange",
.family = AF_INET, .family = AF_INET,
.match = match, .match = iprange_mt,
.matchsize = sizeof(struct ipt_iprange_info), .matchsize = sizeof(struct ipt_iprange_info),
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ipt_iprange_init(void) static int __init iprange_mt_init(void)
{ {
return xt_register_match(&iprange_match); return xt_register_match(&iprange_mt_reg);
} }
static void __exit ipt_iprange_fini(void) static void __exit iprange_mt_exit(void)
{ {
xt_unregister_match(&iprange_match); xt_unregister_match(&iprange_mt_reg);
} }
module_init(ipt_iprange_init); module_init(iprange_mt_init);
module_exit(ipt_iprange_fini); module_exit(iprange_mt_exit);
...@@ -22,14 +22,10 @@ MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>"); ...@@ -22,14 +22,10 @@ MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
MODULE_DESCRIPTION("iptables owner match"); MODULE_DESCRIPTION("iptables owner match");
static bool static bool
match(const struct sk_buff *skb, owner_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct ipt_owner_info *info = matchinfo; const struct ipt_owner_info *info = matchinfo;
...@@ -52,11 +48,9 @@ match(const struct sk_buff *skb, ...@@ -52,11 +48,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, owner_mt_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ipt_owner_info *info = matchinfo; const struct ipt_owner_info *info = matchinfo;
...@@ -68,26 +62,26 @@ checkentry(const char *tablename, ...@@ -68,26 +62,26 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match owner_match __read_mostly = { static struct xt_match owner_mt_reg __read_mostly = {
.name = "owner", .name = "owner",
.family = AF_INET, .family = AF_INET,
.match = match, .match = owner_mt,
.matchsize = sizeof(struct ipt_owner_info), .matchsize = sizeof(struct ipt_owner_info),
.hooks = (1 << NF_INET_LOCAL_OUT) | .hooks = (1 << NF_INET_LOCAL_OUT) |
(1 << NF_INET_POST_ROUTING), (1 << NF_INET_POST_ROUTING),
.checkentry = checkentry, .checkentry = owner_mt_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_owner_init(void) static int __init owner_mt_init(void)
{ {
return xt_register_match(&owner_match); return xt_register_match(&owner_mt_reg);
} }
static void __exit ipt_owner_fini(void) static void __exit owner_mt_exit(void)
{ {
xt_unregister_match(&owner_match); xt_unregister_match(&owner_mt_reg);
} }
module_init(ipt_owner_init); module_init(owner_mt_init);
module_exit(ipt_owner_fini); module_exit(owner_mt_exit);
...@@ -170,10 +170,10 @@ static void recent_table_flush(struct recent_table *t) ...@@ -170,10 +170,10 @@ static void recent_table_flush(struct recent_table *t)
} }
static bool static bool
ipt_recent_match(const struct sk_buff *skb, recent_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, const void *matchinfo, int offset, unsigned int protoff,
int offset, unsigned int protoff, bool *hotdrop) bool *hotdrop)
{ {
const struct ipt_recent_info *info = matchinfo; const struct ipt_recent_info *info = matchinfo;
struct recent_table *t; struct recent_table *t;
...@@ -236,9 +236,9 @@ ipt_recent_match(const struct sk_buff *skb, ...@@ -236,9 +236,9 @@ ipt_recent_match(const struct sk_buff *skb,
} }
static bool static bool
ipt_recent_checkentry(const char *tablename, const void *ip, recent_mt_check(const char *tablename, const void *ip,
const struct xt_match *match, void *matchinfo, const struct xt_match *match, void *matchinfo,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ipt_recent_info *info = matchinfo; const struct ipt_recent_info *info = matchinfo;
struct recent_table *t; struct recent_table *t;
...@@ -293,8 +293,7 @@ ipt_recent_checkentry(const char *tablename, const void *ip, ...@@ -293,8 +293,7 @@ ipt_recent_checkentry(const char *tablename, const void *ip,
return ret; return ret;
} }
static void static void recent_mt_destroy(const struct xt_match *match, void *matchinfo)
ipt_recent_destroy(const struct xt_match *match, void *matchinfo)
{ {
const struct ipt_recent_info *info = matchinfo; const struct ipt_recent_info *info = matchinfo;
struct recent_table *t; struct recent_table *t;
...@@ -455,17 +454,17 @@ static const struct file_operations recent_fops = { ...@@ -455,17 +454,17 @@ static const struct file_operations recent_fops = {
}; };
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static struct xt_match recent_match __read_mostly = { static struct xt_match recent_mt_reg __read_mostly = {
.name = "recent", .name = "recent",
.family = AF_INET, .family = AF_INET,
.match = ipt_recent_match, .match = recent_mt,
.matchsize = sizeof(struct ipt_recent_info), .matchsize = sizeof(struct ipt_recent_info),
.checkentry = ipt_recent_checkentry, .checkentry = recent_mt_check,
.destroy = ipt_recent_destroy, .destroy = recent_mt_destroy,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_recent_init(void) static int __init recent_mt_init(void)
{ {
int err; int err;
...@@ -473,27 +472,27 @@ static int __init ipt_recent_init(void) ...@@ -473,27 +472,27 @@ static int __init ipt_recent_init(void)
return -EINVAL; return -EINVAL;
ip_list_hash_size = 1 << fls(ip_list_tot); ip_list_hash_size = 1 << fls(ip_list_tot);
err = xt_register_match(&recent_match); err = xt_register_match(&recent_mt_reg);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (err) if (err)
return err; return err;
proc_dir = proc_mkdir("ipt_recent", init_net.proc_net); proc_dir = proc_mkdir("ipt_recent", init_net.proc_net);
if (proc_dir == NULL) { if (proc_dir == NULL) {
xt_unregister_match(&recent_match); xt_unregister_match(&recent_mt_reg);
err = -ENOMEM; err = -ENOMEM;
} }
#endif #endif
return err; return err;
} }
static void __exit ipt_recent_exit(void) static void __exit recent_mt_exit(void)
{ {
BUG_ON(!list_empty(&tables)); BUG_ON(!list_empty(&tables));
xt_unregister_match(&recent_match); xt_unregister_match(&recent_mt_reg);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
remove_proc_entry("ipt_recent", init_net.proc_net); remove_proc_entry("ipt_recent", init_net.proc_net);
#endif #endif
} }
module_init(ipt_recent_init); module_init(recent_mt_init);
module_exit(ipt_recent_exit); module_exit(recent_mt_exit);
...@@ -19,37 +19,32 @@ MODULE_LICENSE("GPL"); ...@@ -19,37 +19,32 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("iptables TOS match module"); MODULE_DESCRIPTION("iptables TOS match module");
static bool static bool
match(const struct sk_buff *skb, tos_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct ipt_tos_info *info = matchinfo; const struct ipt_tos_info *info = matchinfo;
return (ip_hdr(skb)->tos == info->tos) ^ info->invert; return (ip_hdr(skb)->tos == info->tos) ^ info->invert;
} }
static struct xt_match tos_match __read_mostly = { static struct xt_match tos_mt_reg __read_mostly = {
.name = "tos", .name = "tos",
.family = AF_INET, .family = AF_INET,
.match = match, .match = tos_mt,
.matchsize = sizeof(struct ipt_tos_info), .matchsize = sizeof(struct ipt_tos_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_multiport_init(void) static int __init tos_mt_init(void)
{ {
return xt_register_match(&tos_match); return xt_register_match(&tos_mt_reg);
} }
static void __exit ipt_multiport_fini(void) static void __exit tos_mt_exit(void)
{ {
xt_unregister_match(&tos_match); xt_unregister_match(&tos_mt_reg);
} }
module_init(ipt_multiport_init); module_init(tos_mt_init);
module_exit(ipt_multiport_fini); module_exit(tos_mt_exit);
...@@ -18,10 +18,10 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); ...@@ -18,10 +18,10 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
MODULE_DESCRIPTION("IP tables TTL matching module"); MODULE_DESCRIPTION("IP tables TTL matching module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, const struct net_device *out, ttl_mt(const struct sk_buff *skb, const struct net_device *in,
const struct xt_match *match, const void *matchinfo, const struct net_device *out, const struct xt_match *match,
int offset, unsigned int protoff, bool *hotdrop) const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
{ {
const struct ipt_ttl_info *info = matchinfo; const struct ipt_ttl_info *info = matchinfo;
const u8 ttl = ip_hdr(skb)->ttl; const u8 ttl = ip_hdr(skb)->ttl;
...@@ -44,23 +44,23 @@ static bool match(const struct sk_buff *skb, ...@@ -44,23 +44,23 @@ static bool match(const struct sk_buff *skb,
return false; return false;
} }
static struct xt_match ttl_match __read_mostly = { static struct xt_match ttl_mt_reg __read_mostly = {
.name = "ttl", .name = "ttl",
.family = AF_INET, .family = AF_INET,
.match = match, .match = ttl_mt,
.matchsize = sizeof(struct ipt_ttl_info), .matchsize = sizeof(struct ipt_ttl_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipt_ttl_init(void) static int __init ttl_mt_init(void)
{ {
return xt_register_match(&ttl_match); return xt_register_match(&ttl_mt_reg);
} }
static void __exit ipt_ttl_fini(void) static void __exit ttl_mt_exit(void)
{ {
xt_unregister_match(&ttl_match); xt_unregister_match(&ttl_mt_reg);
} }
module_init(ipt_ttl_init); module_init(ttl_mt_init);
module_exit(ipt_ttl_fini); module_exit(ttl_mt_exit);
...@@ -18,12 +18,10 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>"); ...@@ -18,12 +18,10 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
MODULE_DESCRIPTION("IP6 tables Hop Limit modification module"); MODULE_DESCRIPTION("IP6 tables Hop Limit modification module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static unsigned int ip6t_hl_target(struct sk_buff *skb, static unsigned int
const struct net_device *in, hl_tg6(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
struct ipv6hdr *ip6h; struct ipv6hdr *ip6h;
const struct ip6t_HL_info *info = targinfo; const struct ip6t_HL_info *info = targinfo;
...@@ -58,11 +56,10 @@ static unsigned int ip6t_hl_target(struct sk_buff *skb, ...@@ -58,11 +56,10 @@ static unsigned int ip6t_hl_target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool ip6t_hl_checkentry(const char *tablename, static bool
const void *entry, hl_tg6_check(const char *tablename, const void *entry,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ip6t_HL_info *info = targinfo; const struct ip6t_HL_info *info = targinfo;
...@@ -79,25 +76,25 @@ static bool ip6t_hl_checkentry(const char *tablename, ...@@ -79,25 +76,25 @@ static bool ip6t_hl_checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ip6t_HL __read_mostly = { static struct xt_target hl_tg6_reg __read_mostly = {
.name = "HL", .name = "HL",
.family = AF_INET6, .family = AF_INET6,
.target = ip6t_hl_target, .target = hl_tg6,
.targetsize = sizeof(struct ip6t_HL_info), .targetsize = sizeof(struct ip6t_HL_info),
.table = "mangle", .table = "mangle",
.checkentry = ip6t_hl_checkentry, .checkentry = hl_tg6_check,
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ip6t_hl_init(void) static int __init hl_tg6_init(void)
{ {
return xt_register_target(&ip6t_HL); return xt_register_target(&hl_tg6_reg);
} }
static void __exit ip6t_hl_fini(void) static void __exit hl_tg6_exit(void)
{ {
xt_unregister_target(&ip6t_HL); xt_unregister_target(&hl_tg6_reg);
} }
module_init(ip6t_hl_init); module_init(hl_tg6_init);
module_exit(ip6t_hl_fini); module_exit(hl_tg6_exit);
...@@ -431,12 +431,9 @@ ip6t_log_packet(unsigned int pf, ...@@ -431,12 +431,9 @@ ip6t_log_packet(unsigned int pf,
} }
static unsigned int static unsigned int
ip6t_log_target(struct sk_buff *skb, log_tg6(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct ip6t_log_info *loginfo = targinfo; const struct ip6t_log_info *loginfo = targinfo;
struct nf_loginfo li; struct nf_loginfo li;
...@@ -450,11 +447,10 @@ ip6t_log_target(struct sk_buff *skb, ...@@ -450,11 +447,10 @@ ip6t_log_target(struct sk_buff *skb,
} }
static bool ip6t_log_checkentry(const char *tablename, static bool
const void *entry, log_tg6_check(const char *tablename, const void *entry,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ip6t_log_info *loginfo = targinfo; const struct ip6t_log_info *loginfo = targinfo;
...@@ -470,12 +466,12 @@ static bool ip6t_log_checkentry(const char *tablename, ...@@ -470,12 +466,12 @@ static bool ip6t_log_checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target ip6t_log_reg __read_mostly = { static struct xt_target log_tg6_reg __read_mostly = {
.name = "LOG", .name = "LOG",
.family = AF_INET6, .family = AF_INET6,
.target = ip6t_log_target, .target = log_tg6,
.targetsize = sizeof(struct ip6t_log_info), .targetsize = sizeof(struct ip6t_log_info),
.checkentry = ip6t_log_checkentry, .checkentry = log_tg6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
...@@ -485,22 +481,22 @@ static struct nf_logger ip6t_logger = { ...@@ -485,22 +481,22 @@ static struct nf_logger ip6t_logger = {
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_log_init(void) static int __init log_tg6_init(void)
{ {
int ret; int ret;
ret = xt_register_target(&ip6t_log_reg); ret = xt_register_target(&log_tg6_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
nf_log_register(PF_INET6, &ip6t_logger); nf_log_register(PF_INET6, &ip6t_logger);
return 0; return 0;
} }
static void __exit ip6t_log_fini(void) static void __exit log_tg6_exit(void)
{ {
nf_log_unregister(&ip6t_logger); nf_log_unregister(&ip6t_logger);
xt_unregister_target(&ip6t_log_reg); xt_unregister_target(&log_tg6_reg);
} }
module_init(ip6t_log_init); module_init(log_tg6_init);
module_exit(ip6t_log_fini); module_exit(log_tg6_exit);
...@@ -170,12 +170,10 @@ send_unreach(struct sk_buff *skb_in, unsigned char code, unsigned int hooknum) ...@@ -170,12 +170,10 @@ send_unreach(struct sk_buff *skb_in, unsigned char code, unsigned int hooknum)
icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0, NULL); icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0, NULL);
} }
static unsigned int reject6_target(struct sk_buff *skb, static unsigned int
const struct net_device *in, reject_tg6(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
const struct ip6t_reject_info *reject = targinfo; const struct ip6t_reject_info *reject = targinfo;
...@@ -214,11 +212,10 @@ static unsigned int reject6_target(struct sk_buff *skb, ...@@ -214,11 +212,10 @@ static unsigned int reject6_target(struct sk_buff *skb,
return NF_DROP; return NF_DROP;
} }
static bool check(const char *tablename, static bool
const void *entry, reject_tg6_check(const char *tablename, const void *entry,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct ip6t_reject_info *rejinfo = targinfo; const struct ip6t_reject_info *rejinfo = targinfo;
const struct ip6t_entry *e = entry; const struct ip6t_entry *e = entry;
...@@ -237,27 +234,27 @@ static bool check(const char *tablename, ...@@ -237,27 +234,27 @@ static bool check(const char *tablename,
return true; return true;
} }
static struct xt_target ip6t_reject_reg __read_mostly = { static struct xt_target reject_tg6_reg __read_mostly = {
.name = "REJECT", .name = "REJECT",
.family = AF_INET6, .family = AF_INET6,
.target = reject6_target, .target = reject_tg6,
.targetsize = sizeof(struct ip6t_reject_info), .targetsize = sizeof(struct ip6t_reject_info),
.table = "filter", .table = "filter",
.hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD) | .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD) |
(1 << NF_INET_LOCAL_OUT), (1 << NF_INET_LOCAL_OUT),
.checkentry = check, .checkentry = reject_tg6_check,
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ip6t_reject_init(void) static int __init reject_tg6_init(void)
{ {
return xt_register_target(&ip6t_reject_reg); return xt_register_target(&reject_tg6_reg);
} }
static void __exit ip6t_reject_fini(void) static void __exit reject_tg6_exit(void)
{ {
xt_unregister_target(&ip6t_reject_reg); xt_unregister_target(&reject_tg6_reg);
} }
module_init(ip6t_reject_init); module_init(reject_tg6_init);
module_exit(ip6t_reject_fini); module_exit(reject_tg6_exit);
...@@ -37,14 +37,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) ...@@ -37,14 +37,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, ah_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ip_auth_hdr _ah; struct ip_auth_hdr _ah;
const struct ip_auth_hdr *ah; const struct ip_auth_hdr *ah;
...@@ -100,11 +95,9 @@ match(const struct sk_buff *skb, ...@@ -100,11 +95,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, ah_mt6_check(const char *tablename, const void *entry,
const void *entry, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_ah *ahinfo = matchinfo; const struct ip6t_ah *ahinfo = matchinfo;
...@@ -115,24 +108,24 @@ checkentry(const char *tablename, ...@@ -115,24 +108,24 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match ah_match __read_mostly = { static struct xt_match ah_mt6_reg __read_mostly = {
.name = "ah", .name = "ah",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = ah_mt6,
.matchsize = sizeof(struct ip6t_ah), .matchsize = sizeof(struct ip6t_ah),
.checkentry = checkentry, .checkentry = ah_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_ah_init(void) static int __init ah_mt6_init(void)
{ {
return xt_register_match(&ah_match); return xt_register_match(&ah_mt6_reg);
} }
static void __exit ip6t_ah_fini(void) static void __exit ah_mt6_exit(void)
{ {
xt_unregister_match(&ah_match); xt_unregister_match(&ah_mt6_reg);
} }
module_init(ip6t_ah_init); module_init(ah_mt6_init);
module_exit(ip6t_ah_fini); module_exit(ah_mt6_exit);
...@@ -20,14 +20,10 @@ MODULE_LICENSE("GPL"); ...@@ -20,14 +20,10 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
static bool static bool
match(const struct sk_buff *skb, eui64_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
unsigned char eui64[8]; unsigned char eui64[8];
int i = 0; int i = 0;
...@@ -62,25 +58,25 @@ match(const struct sk_buff *skb, ...@@ -62,25 +58,25 @@ match(const struct sk_buff *skb,
return false; return false;
} }
static struct xt_match eui64_match __read_mostly = { static struct xt_match eui64_mt6_reg __read_mostly = {
.name = "eui64", .name = "eui64",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = eui64_mt6,
.matchsize = sizeof(int), .matchsize = sizeof(int),
.hooks = (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN) | .hooks = (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD), (1 << NF_INET_FORWARD),
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_eui64_init(void) static int __init eui64_mt6_init(void)
{ {
return xt_register_match(&eui64_match); return xt_register_match(&eui64_mt6_reg);
} }
static void __exit ip6t_eui64_fini(void) static void __exit eui64_mt6_exit(void)
{ {
xt_unregister_match(&eui64_match); xt_unregister_match(&eui64_mt6_reg);
} }
module_init(ip6t_eui64_init); module_init(eui64_mt6_init);
module_exit(ip6t_eui64_fini); module_exit(eui64_mt6_exit);
...@@ -35,14 +35,10 @@ id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) ...@@ -35,14 +35,10 @@ id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, frag_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct frag_hdr _frag; struct frag_hdr _frag;
const struct frag_hdr *fh; const struct frag_hdr *fh;
...@@ -116,11 +112,9 @@ match(const struct sk_buff *skb, ...@@ -116,11 +112,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, frag_mt6_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_frag *fraginfo = matchinfo; const struct ip6t_frag *fraginfo = matchinfo;
...@@ -131,24 +125,24 @@ checkentry(const char *tablename, ...@@ -131,24 +125,24 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match frag_match __read_mostly = { static struct xt_match frag_mt6_reg __read_mostly = {
.name = "frag", .name = "frag",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = frag_mt6,
.matchsize = sizeof(struct ip6t_frag), .matchsize = sizeof(struct ip6t_frag),
.checkentry = checkentry, .checkentry = frag_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_frag_init(void) static int __init frag_mt6_init(void)
{ {
return xt_register_match(&frag_match); return xt_register_match(&frag_mt6_reg);
} }
static void __exit ip6t_frag_fini(void) static void __exit frag_mt6_exit(void)
{ {
xt_unregister_match(&frag_match); xt_unregister_match(&frag_mt6_reg);
} }
module_init(ip6t_frag_init); module_init(frag_mt6_init);
module_exit(ip6t_frag_fini); module_exit(frag_mt6_exit);
...@@ -42,14 +42,10 @@ MODULE_ALIAS("ip6t_dst"); ...@@ -42,14 +42,10 @@ MODULE_ALIAS("ip6t_dst");
*/ */
static bool static bool
match(const struct sk_buff *skb, hbh_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ipv6_opt_hdr _optsh; struct ipv6_opt_hdr _optsh;
const struct ipv6_opt_hdr *oh; const struct ipv6_opt_hdr *oh;
...@@ -171,11 +167,9 @@ match(const struct sk_buff *skb, ...@@ -171,11 +167,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, hbh_mt6_check(const char *tablename, const void *entry,
const void *entry, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_opts *optsinfo = matchinfo; const struct ip6t_opts *optsinfo = matchinfo;
...@@ -186,36 +180,36 @@ checkentry(const char *tablename, ...@@ -186,36 +180,36 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match opts_match[] __read_mostly = { static struct xt_match hbh_mt6_reg[] __read_mostly = {
{ {
.name = "hbh", .name = "hbh",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = hbh_mt6,
.matchsize = sizeof(struct ip6t_opts), .matchsize = sizeof(struct ip6t_opts),
.checkentry = checkentry, .checkentry = hbh_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
.data = NEXTHDR_HOP, .data = NEXTHDR_HOP,
}, },
{ {
.name = "dst", .name = "dst",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = hbh_mt6,
.matchsize = sizeof(struct ip6t_opts), .matchsize = sizeof(struct ip6t_opts),
.checkentry = checkentry, .checkentry = hbh_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
.data = NEXTHDR_DEST, .data = NEXTHDR_DEST,
}, },
}; };
static int __init ip6t_hbh_init(void) static int __init hbh_mt6_init(void)
{ {
return xt_register_matches(opts_match, ARRAY_SIZE(opts_match)); return xt_register_matches(hbh_mt6_reg, ARRAY_SIZE(hbh_mt6_reg));
} }
static void __exit ip6t_hbh_fini(void) static void __exit hbh_mt6_exit(void)
{ {
xt_unregister_matches(opts_match, ARRAY_SIZE(opts_match)); xt_unregister_matches(hbh_mt6_reg, ARRAY_SIZE(hbh_mt6_reg));
} }
module_init(ip6t_hbh_init); module_init(hbh_mt6_init);
module_exit(ip6t_hbh_fini); module_exit(hbh_mt6_exit);
...@@ -19,10 +19,10 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>"); ...@@ -19,10 +19,10 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
MODULE_DESCRIPTION("IP tables Hop Limit matching module"); MODULE_DESCRIPTION("IP tables Hop Limit matching module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, const struct net_device *out, hl_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct xt_match *match, const void *matchinfo, const struct net_device *out, const struct xt_match *match,
int offset, unsigned int protoff, bool *hotdrop) const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
{ {
const struct ip6t_hl_info *info = matchinfo; const struct ip6t_hl_info *info = matchinfo;
const struct ipv6hdr *ip6h = ipv6_hdr(skb); const struct ipv6hdr *ip6h = ipv6_hdr(skb);
...@@ -49,23 +49,23 @@ static bool match(const struct sk_buff *skb, ...@@ -49,23 +49,23 @@ static bool match(const struct sk_buff *skb,
return false; return false;
} }
static struct xt_match hl_match __read_mostly = { static struct xt_match hl_mt6_reg __read_mostly = {
.name = "hl", .name = "hl",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = hl_mt6,
.matchsize = sizeof(struct ip6t_hl_info), .matchsize = sizeof(struct ip6t_hl_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_hl_init(void) static int __init hl_mt6_init(void)
{ {
return xt_register_match(&hl_match); return xt_register_match(&hl_mt6_reg);
} }
static void __exit ip6t_hl_fini(void) static void __exit hl_mt6_exit(void)
{ {
xt_unregister_match(&hl_match); xt_unregister_match(&hl_mt6_reg);
} }
module_init(ip6t_hl_init); module_init(hl_mt6_init);
module_exit(ip6t_hl_fini); module_exit(hl_mt6_exit);
...@@ -27,14 +27,10 @@ MODULE_DESCRIPTION("IPv6 headers match"); ...@@ -27,14 +27,10 @@ MODULE_DESCRIPTION("IPv6 headers match");
MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
static bool static bool
ipv6header_match(const struct sk_buff *skb, ipv6header_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct ip6t_ipv6header_info *info = matchinfo; const struct ip6t_ipv6header_info *info = matchinfo;
unsigned int temp; unsigned int temp;
...@@ -125,11 +121,9 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -125,11 +121,9 @@ ipv6header_match(const struct sk_buff *skb,
} }
static bool static bool
ipv6header_checkentry(const char *tablename, ipv6header_mt6_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_ipv6header_info *info = matchinfo; const struct ip6t_ipv6header_info *info = matchinfo;
...@@ -141,25 +135,25 @@ ipv6header_checkentry(const char *tablename, ...@@ -141,25 +135,25 @@ ipv6header_checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match ip6t_ipv6header_match __read_mostly = { static struct xt_match ipv6header_mt6_reg __read_mostly = {
.name = "ipv6header", .name = "ipv6header",
.family = AF_INET6, .family = AF_INET6,
.match = &ipv6header_match, .match = ipv6header_mt6,
.matchsize = sizeof(struct ip6t_ipv6header_info), .matchsize = sizeof(struct ip6t_ipv6header_info),
.checkentry = &ipv6header_checkentry, .checkentry = ipv6header_mt6_check,
.destroy = NULL, .destroy = NULL,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipv6header_init(void) static int __init ipv6header_mt6_init(void)
{ {
return xt_register_match(&ip6t_ipv6header_match); return xt_register_match(&ipv6header_mt6_reg);
} }
static void __exit ipv6header_exit(void) static void __exit ipv6header_mt6_exit(void)
{ {
xt_unregister_match(&ip6t_ipv6header_match); xt_unregister_match(&ipv6header_mt6_reg);
} }
module_init(ipv6header_init); module_init(ipv6header_mt6_init);
module_exit(ipv6header_exit); module_exit(ipv6header_mt6_exit);
...@@ -38,14 +38,9 @@ type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert) ...@@ -38,14 +38,9 @@ type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, mh_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ip6_mh _mh; struct ip6_mh _mh;
const struct ip6_mh *mh; const struct ip6_mh *mh;
...@@ -77,11 +72,9 @@ match(const struct sk_buff *skb, ...@@ -77,11 +72,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
mh_checkentry(const char *tablename, mh_mt6_check(const char *tablename, const void *entry,
const void *entry, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_mh *mhinfo = matchinfo; const struct ip6t_mh *mhinfo = matchinfo;
...@@ -89,25 +82,25 @@ mh_checkentry(const char *tablename, ...@@ -89,25 +82,25 @@ mh_checkentry(const char *tablename,
return !(mhinfo->invflags & ~IP6T_MH_INV_MASK); return !(mhinfo->invflags & ~IP6T_MH_INV_MASK);
} }
static struct xt_match mh_match __read_mostly = { static struct xt_match mh_mt6_reg __read_mostly = {
.name = "mh", .name = "mh",
.family = AF_INET6, .family = AF_INET6,
.checkentry = mh_checkentry, .checkentry = mh_mt6_check,
.match = match, .match = mh_mt6,
.matchsize = sizeof(struct ip6t_mh), .matchsize = sizeof(struct ip6t_mh),
.proto = IPPROTO_MH, .proto = IPPROTO_MH,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_mh_init(void) static int __init mh_mt6_init(void)
{ {
return xt_register_match(&mh_match); return xt_register_match(&mh_mt6_reg);
} }
static void __exit ip6t_mh_fini(void) static void __exit mh_mt6_exit(void)
{ {
xt_unregister_match(&mh_match); xt_unregister_match(&mh_mt6_reg);
} }
module_init(ip6t_mh_init); module_init(mh_mt6_init);
module_exit(ip6t_mh_fini); module_exit(mh_mt6_exit);
...@@ -24,14 +24,10 @@ MODULE_LICENSE("GPL"); ...@@ -24,14 +24,10 @@ MODULE_LICENSE("GPL");
static bool static bool
match(const struct sk_buff *skb, owner_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct ip6t_owner_info *info = matchinfo; const struct ip6t_owner_info *info = matchinfo;
...@@ -52,11 +48,9 @@ match(const struct sk_buff *skb, ...@@ -52,11 +48,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, owner_mt6_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_owner_info *info = matchinfo; const struct ip6t_owner_info *info = matchinfo;
...@@ -68,26 +62,26 @@ checkentry(const char *tablename, ...@@ -68,26 +62,26 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match owner_match __read_mostly = { static struct xt_match owner_mt6_reg __read_mostly = {
.name = "owner", .name = "owner",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = owner_mt6,
.matchsize = sizeof(struct ip6t_owner_info), .matchsize = sizeof(struct ip6t_owner_info),
.hooks = (1 << NF_INET_LOCAL_OUT) | .hooks = (1 << NF_INET_LOCAL_OUT) |
(1 << NF_INET_POST_ROUTING), (1 << NF_INET_POST_ROUTING),
.checkentry = checkentry, .checkentry = owner_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_owner_init(void) static int __init owner_mt6_init(void)
{ {
return xt_register_match(&owner_match); return xt_register_match(&owner_mt6_reg);
} }
static void __exit ip6t_owner_fini(void) static void __exit owner_mt6_exit(void)
{ {
xt_unregister_match(&owner_match); xt_unregister_match(&owner_mt6_reg);
} }
module_init(ip6t_owner_init); module_init(owner_mt6_init);
module_exit(ip6t_owner_fini); module_exit(owner_mt6_exit);
...@@ -37,14 +37,9 @@ segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) ...@@ -37,14 +37,9 @@ segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, rt_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ipv6_rt_hdr _route; struct ipv6_rt_hdr _route;
const struct ipv6_rt_hdr *rh; const struct ipv6_rt_hdr *rh;
...@@ -195,11 +190,9 @@ match(const struct sk_buff *skb, ...@@ -195,11 +190,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, rt_mt6_check(const char *tablename, const void *entry,
const void *entry, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_rt *rtinfo = matchinfo; const struct ip6t_rt *rtinfo = matchinfo;
...@@ -218,24 +211,24 @@ checkentry(const char *tablename, ...@@ -218,24 +211,24 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match rt_match __read_mostly = { static struct xt_match rt_mt6_reg __read_mostly = {
.name = "rt", .name = "rt",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = rt_mt6,
.matchsize = sizeof(struct ip6t_rt), .matchsize = sizeof(struct ip6t_rt),
.checkentry = checkentry, .checkentry = rt_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ip6t_rt_init(void) static int __init rt_mt6_init(void)
{ {
return xt_register_match(&rt_match); return xt_register_match(&rt_mt6_reg);
} }
static void __exit ip6t_rt_fini(void) static void __exit rt_mt6_exit(void)
{ {
xt_unregister_match(&rt_match); xt_unregister_match(&rt_mt6_reg);
} }
module_init(ip6t_rt_init); module_init(rt_mt6_init);
module_exit(ip6t_rt_fini); module_exit(rt_mt6_exit);
...@@ -27,12 +27,9 @@ MODULE_ALIAS("ipt_CLASSIFY"); ...@@ -27,12 +27,9 @@ MODULE_ALIAS("ipt_CLASSIFY");
MODULE_ALIAS("ip6t_CLASSIFY"); MODULE_ALIAS("ip6t_CLASSIFY");
static unsigned int static unsigned int
target(struct sk_buff *skb, classify_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_classify_target_info *clinfo = targinfo; const struct xt_classify_target_info *clinfo = targinfo;
...@@ -40,11 +37,11 @@ target(struct sk_buff *skb, ...@@ -40,11 +37,11 @@ target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static struct xt_target xt_classify_target[] __read_mostly = { static struct xt_target classify_tg_reg[] __read_mostly = {
{ {
.family = AF_INET, .family = AF_INET,
.name = "CLASSIFY", .name = "CLASSIFY",
.target = target, .target = classify_tg,
.targetsize = sizeof(struct xt_classify_target_info), .targetsize = sizeof(struct xt_classify_target_info),
.table = "mangle", .table = "mangle",
.hooks = (1 << NF_INET_LOCAL_OUT) | .hooks = (1 << NF_INET_LOCAL_OUT) |
...@@ -55,7 +52,7 @@ static struct xt_target xt_classify_target[] __read_mostly = { ...@@ -55,7 +52,7 @@ static struct xt_target xt_classify_target[] __read_mostly = {
{ {
.name = "CLASSIFY", .name = "CLASSIFY",
.family = AF_INET6, .family = AF_INET6,
.target = target, .target = classify_tg,
.targetsize = sizeof(struct xt_classify_target_info), .targetsize = sizeof(struct xt_classify_target_info),
.table = "mangle", .table = "mangle",
.hooks = (1 << NF_INET_LOCAL_OUT) | .hooks = (1 << NF_INET_LOCAL_OUT) |
...@@ -65,17 +62,16 @@ static struct xt_target xt_classify_target[] __read_mostly = { ...@@ -65,17 +62,16 @@ static struct xt_target xt_classify_target[] __read_mostly = {
}, },
}; };
static int __init xt_classify_init(void) static int __init classify_tg_init(void)
{ {
return xt_register_targets(xt_classify_target, return xt_register_targets(classify_tg_reg,
ARRAY_SIZE(xt_classify_target)); ARRAY_SIZE(classify_tg_reg));
} }
static void __exit xt_classify_fini(void) static void __exit classify_tg_exit(void)
{ {
xt_unregister_targets(xt_classify_target, xt_unregister_targets(classify_tg_reg, ARRAY_SIZE(classify_tg_reg));
ARRAY_SIZE(xt_classify_target));
} }
module_init(xt_classify_init); module_init(classify_tg_init);
module_exit(xt_classify_fini); module_exit(classify_tg_exit);
...@@ -34,12 +34,9 @@ MODULE_ALIAS("ip6t_CONNMARK"); ...@@ -34,12 +34,9 @@ MODULE_ALIAS("ip6t_CONNMARK");
#include <net/netfilter/nf_conntrack_ecache.h> #include <net/netfilter/nf_conntrack_ecache.h>
static unsigned int static unsigned int
target(struct sk_buff *skb, connmark_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_connmark_target_info *markinfo = targinfo; const struct xt_connmark_target_info *markinfo = targinfo;
struct nf_conn *ct; struct nf_conn *ct;
...@@ -78,11 +75,9 @@ target(struct sk_buff *skb, ...@@ -78,11 +75,9 @@ target(struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, connmark_tg_check(const char *tablename, const void *entry,
const void *entry, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_connmark_target_info *matchinfo = targinfo; const struct xt_connmark_target_info *matchinfo = targinfo;
...@@ -107,7 +102,7 @@ checkentry(const char *tablename, ...@@ -107,7 +102,7 @@ checkentry(const char *tablename,
} }
static void static void
destroy(const struct xt_target *target, void *targinfo) connmark_tg_destroy(const struct xt_target *target, void *targinfo)
{ {
nf_ct_l3proto_module_put(target->family); nf_ct_l3proto_module_put(target->family);
} }
...@@ -120,7 +115,7 @@ struct compat_xt_connmark_target_info { ...@@ -120,7 +115,7 @@ struct compat_xt_connmark_target_info {
u_int16_t __pad2; u_int16_t __pad2;
}; };
static void compat_from_user(void *dst, void *src) static void connmark_tg_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_connmark_target_info *cm = src; const struct compat_xt_connmark_target_info *cm = src;
struct xt_connmark_target_info m = { struct xt_connmark_target_info m = {
...@@ -131,7 +126,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -131,7 +126,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user(void __user *dst, void *src) static int connmark_tg_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_connmark_target_info *m = src; const struct xt_connmark_target_info *m = src;
struct compat_xt_connmark_target_info cm = { struct compat_xt_connmark_target_info cm = {
...@@ -143,43 +138,42 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -143,43 +138,42 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_target xt_connmark_target[] __read_mostly = { static struct xt_target connmark_tg_reg[] __read_mostly = {
{ {
.name = "CONNMARK", .name = "CONNMARK",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = connmark_tg_check,
.destroy = destroy, .destroy = connmark_tg_destroy,
.target = target, .target = connmark_tg,
.targetsize = sizeof(struct xt_connmark_target_info), .targetsize = sizeof(struct xt_connmark_target_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_connmark_target_info), .compatsize = sizeof(struct compat_xt_connmark_target_info),
.compat_from_user = compat_from_user, .compat_from_user = connmark_tg_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = connmark_tg_compat_to_user,
#endif #endif
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "CONNMARK", .name = "CONNMARK",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = connmark_tg_check,
.destroy = destroy, .destroy = connmark_tg_destroy,
.target = target, .target = connmark_tg,
.targetsize = sizeof(struct xt_connmark_target_info), .targetsize = sizeof(struct xt_connmark_target_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_connmark_init(void) static int __init connmark_tg_init(void)
{ {
return xt_register_targets(xt_connmark_target, return xt_register_targets(connmark_tg_reg,
ARRAY_SIZE(xt_connmark_target)); ARRAY_SIZE(connmark_tg_reg));
} }
static void __exit xt_connmark_fini(void) static void __exit connmark_tg_exit(void)
{ {
xt_unregister_targets(xt_connmark_target, xt_unregister_targets(connmark_tg_reg, ARRAY_SIZE(connmark_tg_reg));
ARRAY_SIZE(xt_connmark_target));
} }
module_init(xt_connmark_init); module_init(connmark_tg_init);
module_exit(xt_connmark_fini); module_exit(connmark_tg_exit);
...@@ -61,10 +61,10 @@ static void secmark_restore(struct sk_buff *skb) ...@@ -61,10 +61,10 @@ static void secmark_restore(struct sk_buff *skb)
} }
} }
static unsigned int target(struct sk_buff *skb, const struct net_device *in, static unsigned int
const struct net_device *out, unsigned int hooknum, connsecmark_tg(struct sk_buff *skb, const struct net_device *in,
const struct xt_target *target, const struct net_device *out, unsigned int hooknum,
const void *targinfo) const struct xt_target *target, const void *targinfo)
{ {
const struct xt_connsecmark_target_info *info = targinfo; const struct xt_connsecmark_target_info *info = targinfo;
...@@ -84,9 +84,10 @@ static unsigned int target(struct sk_buff *skb, const struct net_device *in, ...@@ -84,9 +84,10 @@ static unsigned int target(struct sk_buff *skb, const struct net_device *in,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool checkentry(const char *tablename, const void *entry, static bool
const struct xt_target *target, void *targinfo, connsecmark_tg_check(const char *tablename, const void *entry,
unsigned int hook_mask) const struct xt_target *target, void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_connsecmark_target_info *info = targinfo; const struct xt_connsecmark_target_info *info = targinfo;
...@@ -109,18 +110,18 @@ static bool checkentry(const char *tablename, const void *entry, ...@@ -109,18 +110,18 @@ static bool checkentry(const char *tablename, const void *entry,
} }
static void static void
destroy(const struct xt_target *target, void *targinfo) connsecmark_tg_destroy(const struct xt_target *target, void *targinfo)
{ {
nf_ct_l3proto_module_put(target->family); nf_ct_l3proto_module_put(target->family);
} }
static struct xt_target xt_connsecmark_target[] __read_mostly = { static struct xt_target connsecmark_tg_reg[] __read_mostly = {
{ {
.name = "CONNSECMARK", .name = "CONNSECMARK",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = connsecmark_tg_check,
.destroy = destroy, .destroy = connsecmark_tg_destroy,
.target = target, .target = connsecmark_tg,
.targetsize = sizeof(struct xt_connsecmark_target_info), .targetsize = sizeof(struct xt_connsecmark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -128,26 +129,26 @@ static struct xt_target xt_connsecmark_target[] __read_mostly = { ...@@ -128,26 +129,26 @@ static struct xt_target xt_connsecmark_target[] __read_mostly = {
{ {
.name = "CONNSECMARK", .name = "CONNSECMARK",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = connsecmark_tg_check,
.destroy = destroy, .destroy = connsecmark_tg_destroy,
.target = target, .target = connsecmark_tg,
.targetsize = sizeof(struct xt_connsecmark_target_info), .targetsize = sizeof(struct xt_connsecmark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_connsecmark_init(void) static int __init connsecmark_tg_init(void)
{ {
return xt_register_targets(xt_connsecmark_target, return xt_register_targets(connsecmark_tg_reg,
ARRAY_SIZE(xt_connsecmark_target)); ARRAY_SIZE(connsecmark_tg_reg));
} }
static void __exit xt_connsecmark_fini(void) static void __exit connsecmark_tg_exit(void)
{ {
xt_unregister_targets(xt_connsecmark_target, xt_unregister_targets(connsecmark_tg_reg,
ARRAY_SIZE(xt_connsecmark_target)); ARRAY_SIZE(connsecmark_tg_reg));
} }
module_init(xt_connsecmark_init); module_init(connsecmark_tg_init);
module_exit(xt_connsecmark_fini); module_exit(connsecmark_tg_exit);
...@@ -25,12 +25,10 @@ MODULE_LICENSE("GPL"); ...@@ -25,12 +25,10 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_DSCP"); MODULE_ALIAS("ipt_DSCP");
MODULE_ALIAS("ip6t_DSCP"); MODULE_ALIAS("ip6t_DSCP");
static unsigned int target(struct sk_buff *skb, static unsigned int
const struct net_device *in, dscp_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_DSCP_info *dinfo = targinfo; const struct xt_DSCP_info *dinfo = targinfo;
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT; u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
...@@ -46,12 +44,10 @@ static unsigned int target(struct sk_buff *skb, ...@@ -46,12 +44,10 @@ static unsigned int target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static unsigned int target6(struct sk_buff *skb, static unsigned int
const struct net_device *in, dscp_tg6(struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const void *targinfo)
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_DSCP_info *dinfo = targinfo; const struct xt_DSCP_info *dinfo = targinfo;
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT; u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
...@@ -66,11 +62,10 @@ static unsigned int target6(struct sk_buff *skb, ...@@ -66,11 +62,10 @@ static unsigned int target6(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool checkentry(const char *tablename, static bool
const void *e_void, dscp_tg_check(const char *tablename, const void *e_void,
const struct xt_target *target, const struct xt_target *target, void *targinfo,
void *targinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const u_int8_t dscp = ((struct xt_DSCP_info *)targinfo)->dscp; const u_int8_t dscp = ((struct xt_DSCP_info *)targinfo)->dscp;
...@@ -81,12 +76,12 @@ static bool checkentry(const char *tablename, ...@@ -81,12 +76,12 @@ static bool checkentry(const char *tablename,
return true; return true;
} }
static struct xt_target xt_dscp_target[] __read_mostly = { static struct xt_target dscp_tg_reg[] __read_mostly = {
{ {
.name = "DSCP", .name = "DSCP",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = dscp_tg_check,
.target = target, .target = dscp_tg,
.targetsize = sizeof(struct xt_DSCP_info), .targetsize = sizeof(struct xt_DSCP_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -94,23 +89,23 @@ static struct xt_target xt_dscp_target[] __read_mostly = { ...@@ -94,23 +89,23 @@ static struct xt_target xt_dscp_target[] __read_mostly = {
{ {
.name = "DSCP", .name = "DSCP",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = dscp_tg_check,
.target = target6, .target = dscp_tg6,
.targetsize = sizeof(struct xt_DSCP_info), .targetsize = sizeof(struct xt_DSCP_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_dscp_target_init(void) static int __init dscp_tg_init(void)
{ {
return xt_register_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target)); return xt_register_targets(dscp_tg_reg, ARRAY_SIZE(dscp_tg_reg));
} }
static void __exit xt_dscp_target_fini(void) static void __exit dscp_tg_exit(void)
{ {
xt_unregister_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target)); xt_unregister_targets(dscp_tg_reg, ARRAY_SIZE(dscp_tg_reg));
} }
module_init(xt_dscp_target_init); module_init(dscp_tg_init);
module_exit(xt_dscp_target_fini); module_exit(dscp_tg_exit);
...@@ -22,12 +22,9 @@ MODULE_ALIAS("ipt_MARK"); ...@@ -22,12 +22,9 @@ MODULE_ALIAS("ipt_MARK");
MODULE_ALIAS("ip6t_MARK"); MODULE_ALIAS("ip6t_MARK");
static unsigned int static unsigned int
target_v0(struct sk_buff *skb, mark_tg_v0(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_mark_target_info *markinfo = targinfo; const struct xt_mark_target_info *markinfo = targinfo;
...@@ -36,12 +33,9 @@ target_v0(struct sk_buff *skb, ...@@ -36,12 +33,9 @@ target_v0(struct sk_buff *skb,
} }
static unsigned int static unsigned int
target_v1(struct sk_buff *skb, mark_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_mark_target_info_v1 *markinfo = targinfo; const struct xt_mark_target_info_v1 *markinfo = targinfo;
int mark = 0; int mark = 0;
...@@ -64,13 +58,10 @@ target_v1(struct sk_buff *skb, ...@@ -64,13 +58,10 @@ target_v1(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static bool static bool
checkentry_v0(const char *tablename, mark_tg_check_v0(const char *tablename, const void *entry,
const void *entry, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_mark_target_info *markinfo = targinfo; const struct xt_mark_target_info *markinfo = targinfo;
...@@ -82,11 +73,9 @@ checkentry_v0(const char *tablename, ...@@ -82,11 +73,9 @@ checkentry_v0(const char *tablename,
} }
static bool static bool
checkentry_v1(const char *tablename, mark_tg_check(const char *tablename, const void *entry,
const void *entry, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_mark_target_info_v1 *markinfo = targinfo; const struct xt_mark_target_info_v1 *markinfo = targinfo;
...@@ -112,7 +101,7 @@ struct compat_xt_mark_target_info_v1 { ...@@ -112,7 +101,7 @@ struct compat_xt_mark_target_info_v1 {
u_int16_t __pad2; u_int16_t __pad2;
}; };
static void compat_from_user_v1(void *dst, void *src) static void mark_tg_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_mark_target_info_v1 *cm = src; const struct compat_xt_mark_target_info_v1 *cm = src;
struct xt_mark_target_info_v1 m = { struct xt_mark_target_info_v1 m = {
...@@ -122,7 +111,7 @@ static void compat_from_user_v1(void *dst, void *src) ...@@ -122,7 +111,7 @@ static void compat_from_user_v1(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user_v1(void __user *dst, void *src) static int mark_tg_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_mark_target_info_v1 *m = src; const struct xt_mark_target_info_v1 *m = src;
struct compat_xt_mark_target_info_v1 cm = { struct compat_xt_mark_target_info_v1 cm = {
...@@ -133,13 +122,13 @@ static int compat_to_user_v1(void __user *dst, void *src) ...@@ -133,13 +122,13 @@ static int compat_to_user_v1(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_target xt_mark_target[] __read_mostly = { static struct xt_target mark_tg_reg[] __read_mostly = {
{ {
.name = "MARK", .name = "MARK",
.family = AF_INET, .family = AF_INET,
.revision = 0, .revision = 0,
.checkentry = checkentry_v0, .checkentry = mark_tg_check_v0,
.target = target_v0, .target = mark_tg_v0,
.targetsize = sizeof(struct xt_mark_target_info), .targetsize = sizeof(struct xt_mark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -148,13 +137,13 @@ static struct xt_target xt_mark_target[] __read_mostly = { ...@@ -148,13 +137,13 @@ static struct xt_target xt_mark_target[] __read_mostly = {
.name = "MARK", .name = "MARK",
.family = AF_INET, .family = AF_INET,
.revision = 1, .revision = 1,
.checkentry = checkentry_v1, .checkentry = mark_tg_check,
.target = target_v1, .target = mark_tg,
.targetsize = sizeof(struct xt_mark_target_info_v1), .targetsize = sizeof(struct xt_mark_target_info_v1),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_mark_target_info_v1), .compatsize = sizeof(struct compat_xt_mark_target_info_v1),
.compat_from_user = compat_from_user_v1, .compat_from_user = mark_tg_compat_from_user,
.compat_to_user = compat_to_user_v1, .compat_to_user = mark_tg_compat_to_user,
#endif #endif
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -163,23 +152,23 @@ static struct xt_target xt_mark_target[] __read_mostly = { ...@@ -163,23 +152,23 @@ static struct xt_target xt_mark_target[] __read_mostly = {
.name = "MARK", .name = "MARK",
.family = AF_INET6, .family = AF_INET6,
.revision = 0, .revision = 0,
.checkentry = checkentry_v0, .checkentry = mark_tg_check_v0,
.target = target_v0, .target = mark_tg_v0,
.targetsize = sizeof(struct xt_mark_target_info), .targetsize = sizeof(struct xt_mark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_mark_init(void) static int __init mark_tg_init(void)
{ {
return xt_register_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target)); return xt_register_targets(mark_tg_reg, ARRAY_SIZE(mark_tg_reg));
} }
static void __exit xt_mark_fini(void) static void __exit mark_tg_exit(void)
{ {
xt_unregister_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target)); xt_unregister_targets(mark_tg_reg, ARRAY_SIZE(mark_tg_reg));
} }
module_init(xt_mark_init); module_init(mark_tg_init);
module_exit(xt_mark_fini); module_exit(mark_tg_exit);
...@@ -20,10 +20,9 @@ MODULE_ALIAS("ipt_NFLOG"); ...@@ -20,10 +20,9 @@ MODULE_ALIAS("ipt_NFLOG");
MODULE_ALIAS("ip6t_NFLOG"); MODULE_ALIAS("ip6t_NFLOG");
static unsigned int static unsigned int
nflog_target(struct sk_buff *skb, nflog_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct net_device *out, unsigned int hooknum,
unsigned int hooknum, const struct xt_target *target, const struct xt_target *target, const void *targinfo)
const void *targinfo)
{ {
const struct xt_nflog_info *info = targinfo; const struct xt_nflog_info *info = targinfo;
struct nf_loginfo li; struct nf_loginfo li;
...@@ -39,9 +38,9 @@ nflog_target(struct sk_buff *skb, ...@@ -39,9 +38,9 @@ nflog_target(struct sk_buff *skb,
} }
static bool static bool
nflog_checkentry(const char *tablename, const void *entry, nflog_tg_check(const char *tablename, const void *entry,
const struct xt_target *target, void *targetinfo, const struct xt_target *target, void *targetinfo,
unsigned int hookmask) unsigned int hookmask)
{ {
const struct xt_nflog_info *info = targetinfo; const struct xt_nflog_info *info = targetinfo;
...@@ -52,35 +51,34 @@ nflog_checkentry(const char *tablename, const void *entry, ...@@ -52,35 +51,34 @@ nflog_checkentry(const char *tablename, const void *entry,
return true; return true;
} }
static struct xt_target xt_nflog_target[] __read_mostly = { static struct xt_target nflog_tg_reg[] __read_mostly = {
{ {
.name = "NFLOG", .name = "NFLOG",
.family = AF_INET, .family = AF_INET,
.checkentry = nflog_checkentry, .checkentry = nflog_tg_check,
.target = nflog_target, .target = nflog_tg,
.targetsize = sizeof(struct xt_nflog_info), .targetsize = sizeof(struct xt_nflog_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "NFLOG", .name = "NFLOG",
.family = AF_INET6, .family = AF_INET6,
.checkentry = nflog_checkentry, .checkentry = nflog_tg_check,
.target = nflog_target, .target = nflog_tg,
.targetsize = sizeof(struct xt_nflog_info), .targetsize = sizeof(struct xt_nflog_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_nflog_init(void) static int __init nflog_tg_init(void)
{ {
return xt_register_targets(xt_nflog_target, return xt_register_targets(nflog_tg_reg, ARRAY_SIZE(nflog_tg_reg));
ARRAY_SIZE(xt_nflog_target));
} }
static void __exit xt_nflog_fini(void) static void __exit nflog_tg_exit(void)
{ {
xt_unregister_targets(xt_nflog_target, ARRAY_SIZE(xt_nflog_target)); xt_unregister_targets(nflog_tg_reg, ARRAY_SIZE(nflog_tg_reg));
} }
module_init(xt_nflog_init); module_init(nflog_tg_init);
module_exit(xt_nflog_fini); module_exit(nflog_tg_exit);
...@@ -24,52 +24,48 @@ MODULE_ALIAS("ip6t_NFQUEUE"); ...@@ -24,52 +24,48 @@ MODULE_ALIAS("ip6t_NFQUEUE");
MODULE_ALIAS("arpt_NFQUEUE"); MODULE_ALIAS("arpt_NFQUEUE");
static unsigned int static unsigned int
target(struct sk_buff *skb, nfqueue_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
const struct xt_NFQ_info *tinfo = targinfo; const struct xt_NFQ_info *tinfo = targinfo;
return NF_QUEUE_NR(tinfo->queuenum); return NF_QUEUE_NR(tinfo->queuenum);
} }
static struct xt_target xt_nfqueue_target[] __read_mostly = { static struct xt_target nfqueue_tg_reg[] __read_mostly = {
{ {
.name = "NFQUEUE", .name = "NFQUEUE",
.family = AF_INET, .family = AF_INET,
.target = target, .target = nfqueue_tg,
.targetsize = sizeof(struct xt_NFQ_info), .targetsize = sizeof(struct xt_NFQ_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "NFQUEUE", .name = "NFQUEUE",
.family = AF_INET6, .family = AF_INET6,
.target = target, .target = nfqueue_tg,
.targetsize = sizeof(struct xt_NFQ_info), .targetsize = sizeof(struct xt_NFQ_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "NFQUEUE", .name = "NFQUEUE",
.family = NF_ARP, .family = NF_ARP,
.target = target, .target = nfqueue_tg,
.targetsize = sizeof(struct xt_NFQ_info), .targetsize = sizeof(struct xt_NFQ_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_nfqueue_init(void) static int __init nfqueue_tg_init(void)
{ {
return xt_register_targets(xt_nfqueue_target, return xt_register_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
ARRAY_SIZE(xt_nfqueue_target));
} }
static void __exit xt_nfqueue_fini(void) static void __exit nfqueue_tg_exit(void)
{ {
xt_unregister_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target)); xt_unregister_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
} }
module_init(xt_nfqueue_init); module_init(nfqueue_tg_init);
module_exit(xt_nfqueue_fini); module_exit(nfqueue_tg_exit);
...@@ -12,12 +12,9 @@ MODULE_ALIAS("ipt_NOTRACK"); ...@@ -12,12 +12,9 @@ MODULE_ALIAS("ipt_NOTRACK");
MODULE_ALIAS("ip6t_NOTRACK"); MODULE_ALIAS("ip6t_NOTRACK");
static unsigned int static unsigned int
target(struct sk_buff *skb, notrack_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
/* Previously seen (loopback)? Ignore. */ /* Previously seen (loopback)? Ignore. */
if (skb->nfct != NULL) if (skb->nfct != NULL)
...@@ -34,33 +31,32 @@ target(struct sk_buff *skb, ...@@ -34,33 +31,32 @@ target(struct sk_buff *skb,
return XT_CONTINUE; return XT_CONTINUE;
} }
static struct xt_target xt_notrack_target[] __read_mostly = { static struct xt_target notrack_tg_reg[] __read_mostly = {
{ {
.name = "NOTRACK", .name = "NOTRACK",
.family = AF_INET, .family = AF_INET,
.target = target, .target = notrack_tg,
.table = "raw", .table = "raw",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "NOTRACK", .name = "NOTRACK",
.family = AF_INET6, .family = AF_INET6,
.target = target, .target = notrack_tg,
.table = "raw", .table = "raw",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_notrack_init(void) static int __init notrack_tg_init(void)
{ {
return xt_register_targets(xt_notrack_target, return xt_register_targets(notrack_tg_reg, ARRAY_SIZE(notrack_tg_reg));
ARRAY_SIZE(xt_notrack_target));
} }
static void __exit xt_notrack_fini(void) static void __exit notrack_tg_exit(void)
{ {
xt_unregister_targets(xt_notrack_target, ARRAY_SIZE(xt_notrack_target)); xt_unregister_targets(notrack_tg_reg, ARRAY_SIZE(notrack_tg_reg));
} }
module_init(xt_notrack_init); module_init(notrack_tg_init);
module_exit(xt_notrack_fini); module_exit(notrack_tg_exit);
...@@ -28,10 +28,10 @@ MODULE_ALIAS("ip6t_SECMARK"); ...@@ -28,10 +28,10 @@ MODULE_ALIAS("ip6t_SECMARK");
static u8 mode; static u8 mode;
static unsigned int target(struct sk_buff *skb, const struct net_device *in, static unsigned int
const struct net_device *out, unsigned int hooknum, secmark_tg(struct sk_buff *skb, const struct net_device *in,
const struct xt_target *target, const struct net_device *out, unsigned int hooknum,
const void *targinfo) const struct xt_target *target, const void *targinfo)
{ {
u32 secmark = 0; u32 secmark = 0;
const struct xt_secmark_target_info *info = targinfo; const struct xt_secmark_target_info *info = targinfo;
...@@ -81,9 +81,10 @@ static bool checkentry_selinux(struct xt_secmark_target_info *info) ...@@ -81,9 +81,10 @@ static bool checkentry_selinux(struct xt_secmark_target_info *info)
return true; return true;
} }
static bool checkentry(const char *tablename, const void *entry, static bool
const struct xt_target *target, void *targinfo, secmark_tg_check(const char *tablename, const void *entry,
unsigned int hook_mask) const struct xt_target *target, void *targinfo,
unsigned int hook_mask)
{ {
struct xt_secmark_target_info *info = targinfo; struct xt_secmark_target_info *info = targinfo;
...@@ -109,12 +110,12 @@ static bool checkentry(const char *tablename, const void *entry, ...@@ -109,12 +110,12 @@ static bool checkentry(const char *tablename, const void *entry,
return true; return true;
} }
static struct xt_target xt_secmark_target[] __read_mostly = { static struct xt_target secmark_tg_reg[] __read_mostly = {
{ {
.name = "SECMARK", .name = "SECMARK",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = secmark_tg_check,
.target = target, .target = secmark_tg,
.targetsize = sizeof(struct xt_secmark_target_info), .targetsize = sizeof(struct xt_secmark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -122,24 +123,23 @@ static struct xt_target xt_secmark_target[] __read_mostly = { ...@@ -122,24 +123,23 @@ static struct xt_target xt_secmark_target[] __read_mostly = {
{ {
.name = "SECMARK", .name = "SECMARK",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = secmark_tg_check,
.target = target, .target = secmark_tg,
.targetsize = sizeof(struct xt_secmark_target_info), .targetsize = sizeof(struct xt_secmark_target_info),
.table = "mangle", .table = "mangle",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_secmark_init(void) static int __init secmark_tg_init(void)
{ {
return xt_register_targets(xt_secmark_target, return xt_register_targets(secmark_tg_reg, ARRAY_SIZE(secmark_tg_reg));
ARRAY_SIZE(xt_secmark_target));
} }
static void __exit xt_secmark_fini(void) static void __exit secmark_tg_exit(void)
{ {
xt_unregister_targets(xt_secmark_target, ARRAY_SIZE(xt_secmark_target)); xt_unregister_targets(secmark_tg_reg, ARRAY_SIZE(secmark_tg_reg));
} }
module_init(xt_secmark_init); module_init(secmark_tg_init);
module_exit(xt_secmark_fini); module_exit(secmark_tg_exit);
...@@ -135,12 +135,9 @@ tcpmss_mangle_packet(struct sk_buff *skb, ...@@ -135,12 +135,9 @@ tcpmss_mangle_packet(struct sk_buff *skb,
} }
static unsigned int static unsigned int
xt_tcpmss_target4(struct sk_buff *skb, tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
__be16 newlen; __be16 newlen;
...@@ -161,12 +158,9 @@ xt_tcpmss_target4(struct sk_buff *skb, ...@@ -161,12 +158,9 @@ xt_tcpmss_target4(struct sk_buff *skb,
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
static unsigned int static unsigned int
xt_tcpmss_target6(struct sk_buff *skb, tcpmss_tg6(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
struct ipv6hdr *ipv6h = ipv6_hdr(skb); struct ipv6hdr *ipv6h = ipv6_hdr(skb);
u8 nexthdr; u8 nexthdr;
...@@ -205,11 +199,9 @@ static inline bool find_syn_match(const struct xt_entry_match *m) ...@@ -205,11 +199,9 @@ static inline bool find_syn_match(const struct xt_entry_match *m)
} }
static bool static bool
xt_tcpmss_checkentry4(const char *tablename, tcpmss_tg4_check(const char *tablename, const void *entry,
const void *entry, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_tcpmss_info *info = targinfo; const struct xt_tcpmss_info *info = targinfo;
const struct ipt_entry *e = entry; const struct ipt_entry *e = entry;
...@@ -230,11 +222,9 @@ xt_tcpmss_checkentry4(const char *tablename, ...@@ -230,11 +222,9 @@ xt_tcpmss_checkentry4(const char *tablename,
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
static bool static bool
xt_tcpmss_checkentry6(const char *tablename, tcpmss_tg6_check(const char *tablename, const void *entry,
const void *entry, const struct xt_target *target, void *targinfo,
const struct xt_target *target, unsigned int hook_mask)
void *targinfo,
unsigned int hook_mask)
{ {
const struct xt_tcpmss_info *info = targinfo; const struct xt_tcpmss_info *info = targinfo;
const struct ip6t_entry *e = entry; const struct ip6t_entry *e = entry;
...@@ -254,12 +244,12 @@ xt_tcpmss_checkentry6(const char *tablename, ...@@ -254,12 +244,12 @@ xt_tcpmss_checkentry6(const char *tablename,
} }
#endif #endif
static struct xt_target xt_tcpmss_reg[] __read_mostly = { static struct xt_target tcpmss_tg_reg[] __read_mostly = {
{ {
.family = AF_INET, .family = AF_INET,
.name = "TCPMSS", .name = "TCPMSS",
.checkentry = xt_tcpmss_checkentry4, .checkentry = tcpmss_tg4_check,
.target = xt_tcpmss_target4, .target = tcpmss_tg4,
.targetsize = sizeof(struct xt_tcpmss_info), .targetsize = sizeof(struct xt_tcpmss_info),
.proto = IPPROTO_TCP, .proto = IPPROTO_TCP,
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -268,8 +258,8 @@ static struct xt_target xt_tcpmss_reg[] __read_mostly = { ...@@ -268,8 +258,8 @@ static struct xt_target xt_tcpmss_reg[] __read_mostly = {
{ {
.family = AF_INET6, .family = AF_INET6,
.name = "TCPMSS", .name = "TCPMSS",
.checkentry = xt_tcpmss_checkentry6, .checkentry = tcpmss_tg6_check,
.target = xt_tcpmss_target6, .target = tcpmss_tg6,
.targetsize = sizeof(struct xt_tcpmss_info), .targetsize = sizeof(struct xt_tcpmss_info),
.proto = IPPROTO_TCP, .proto = IPPROTO_TCP,
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -277,15 +267,15 @@ static struct xt_target xt_tcpmss_reg[] __read_mostly = { ...@@ -277,15 +267,15 @@ static struct xt_target xt_tcpmss_reg[] __read_mostly = {
#endif #endif
}; };
static int __init xt_tcpmss_init(void) static int __init tcpmss_tg_init(void)
{ {
return xt_register_targets(xt_tcpmss_reg, ARRAY_SIZE(xt_tcpmss_reg)); return xt_register_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));
} }
static void __exit xt_tcpmss_fini(void) static void __exit tcpmss_tg_exit(void)
{ {
xt_unregister_targets(xt_tcpmss_reg, ARRAY_SIZE(xt_tcpmss_reg)); xt_unregister_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));
} }
module_init(xt_tcpmss_init); module_init(tcpmss_tg_init);
module_exit(xt_tcpmss_fini); module_exit(tcpmss_tg_exit);
...@@ -10,44 +10,40 @@ MODULE_ALIAS("ipt_TRACE"); ...@@ -10,44 +10,40 @@ MODULE_ALIAS("ipt_TRACE");
MODULE_ALIAS("ip6t_TRACE"); MODULE_ALIAS("ip6t_TRACE");
static unsigned int static unsigned int
target(struct sk_buff *skb, trace_tg(struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, unsigned int hooknum,
const struct net_device *out, const struct xt_target *target, const void *targinfo)
unsigned int hooknum,
const struct xt_target *target,
const void *targinfo)
{ {
skb->nf_trace = 1; skb->nf_trace = 1;
return XT_CONTINUE; return XT_CONTINUE;
} }
static struct xt_target xt_trace_target[] __read_mostly = { static struct xt_target trace_tg_reg[] __read_mostly = {
{ {
.name = "TRACE", .name = "TRACE",
.family = AF_INET, .family = AF_INET,
.target = target, .target = trace_tg,
.table = "raw", .table = "raw",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "TRACE", .name = "TRACE",
.family = AF_INET6, .family = AF_INET6,
.target = target, .target = trace_tg,
.table = "raw", .table = "raw",
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_trace_init(void) static int __init trace_tg_init(void)
{ {
return xt_register_targets(xt_trace_target, return xt_register_targets(trace_tg_reg, ARRAY_SIZE(trace_tg_reg));
ARRAY_SIZE(xt_trace_target));
} }
static void __exit xt_trace_fini(void) static void __exit trace_tg_exit(void)
{ {
xt_unregister_targets(xt_trace_target, ARRAY_SIZE(xt_trace_target)); xt_unregister_targets(trace_tg_reg, ARRAY_SIZE(trace_tg_reg));
} }
module_init(xt_trace_init); module_init(trace_tg_init);
module_exit(xt_trace_fini); module_exit(trace_tg_exit);
...@@ -16,46 +16,41 @@ MODULE_ALIAS("ipt_comment"); ...@@ -16,46 +16,41 @@ MODULE_ALIAS("ipt_comment");
MODULE_ALIAS("ip6t_comment"); MODULE_ALIAS("ip6t_comment");
static bool static bool
match(const struct sk_buff *skb, comment_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protooff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protooff,
bool *hotdrop)
{ {
/* We always match */ /* We always match */
return true; return true;
} }
static struct xt_match xt_comment_match[] __read_mostly = { static struct xt_match comment_mt_reg[] __read_mostly = {
{ {
.name = "comment", .name = "comment",
.family = AF_INET, .family = AF_INET,
.match = match, .match = comment_mt,
.matchsize = sizeof(struct xt_comment_info), .matchsize = sizeof(struct xt_comment_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "comment", .name = "comment",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = comment_mt,
.matchsize = sizeof(struct xt_comment_info), .matchsize = sizeof(struct xt_comment_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_comment_init(void) static int __init comment_mt_init(void)
{ {
return xt_register_matches(xt_comment_match, return xt_register_matches(comment_mt_reg, ARRAY_SIZE(comment_mt_reg));
ARRAY_SIZE(xt_comment_match));
} }
static void __exit xt_comment_fini(void) static void __exit comment_mt_exit(void)
{ {
xt_unregister_matches(xt_comment_match, ARRAY_SIZE(xt_comment_match)); xt_unregister_matches(comment_mt_reg, ARRAY_SIZE(comment_mt_reg));
} }
module_init(xt_comment_init); module_init(comment_mt_init);
module_exit(xt_comment_fini); module_exit(comment_mt_exit);
...@@ -17,14 +17,10 @@ MODULE_ALIAS("ipt_connbytes"); ...@@ -17,14 +17,10 @@ MODULE_ALIAS("ipt_connbytes");
MODULE_ALIAS("ip6t_connbytes"); MODULE_ALIAS("ip6t_connbytes");
static bool static bool
match(const struct sk_buff *skb, connbytes_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_connbytes_info *sinfo = matchinfo; const struct xt_connbytes_info *sinfo = matchinfo;
const struct nf_conn *ct; const struct nf_conn *ct;
...@@ -96,11 +92,10 @@ match(const struct sk_buff *skb, ...@@ -96,11 +92,10 @@ match(const struct sk_buff *skb,
return what >= sinfo->count.from; return what >= sinfo->count.from;
} }
static bool check(const char *tablename, static bool
const void *ip, connbytes_mt_check(const char *tablename, const void *ip,
const struct xt_match *match, const struct xt_match *match, void *matchinfo,
void *matchinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const struct xt_connbytes_info *sinfo = matchinfo; const struct xt_connbytes_info *sinfo = matchinfo;
...@@ -124,43 +119,42 @@ static bool check(const char *tablename, ...@@ -124,43 +119,42 @@ static bool check(const char *tablename,
} }
static void static void
destroy(const struct xt_match *match, void *matchinfo) connbytes_mt_destroy(const struct xt_match *match, void *matchinfo)
{ {
nf_ct_l3proto_module_put(match->family); nf_ct_l3proto_module_put(match->family);
} }
static struct xt_match xt_connbytes_match[] __read_mostly = { static struct xt_match connbytes_mt_reg[] __read_mostly = {
{ {
.name = "connbytes", .name = "connbytes",
.family = AF_INET, .family = AF_INET,
.checkentry = check, .checkentry = connbytes_mt_check,
.match = match, .match = connbytes_mt,
.destroy = destroy, .destroy = connbytes_mt_destroy,
.matchsize = sizeof(struct xt_connbytes_info), .matchsize = sizeof(struct xt_connbytes_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "connbytes", .name = "connbytes",
.family = AF_INET6, .family = AF_INET6,
.checkentry = check, .checkentry = connbytes_mt_check,
.match = match, .match = connbytes_mt,
.destroy = destroy, .destroy = connbytes_mt_destroy,
.matchsize = sizeof(struct xt_connbytes_info), .matchsize = sizeof(struct xt_connbytes_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_connbytes_init(void) static int __init connbytes_mt_init(void)
{ {
return xt_register_matches(xt_connbytes_match, return xt_register_matches(connbytes_mt_reg,
ARRAY_SIZE(xt_connbytes_match)); ARRAY_SIZE(connbytes_mt_reg));
} }
static void __exit xt_connbytes_fini(void) static void __exit connbytes_mt_exit(void)
{ {
xt_unregister_matches(xt_connbytes_match, xt_unregister_matches(connbytes_mt_reg, ARRAY_SIZE(connbytes_mt_reg));
ARRAY_SIZE(xt_connbytes_match));
} }
module_init(xt_connbytes_init); module_init(connbytes_mt_init);
module_exit(xt_connbytes_fini); module_exit(connbytes_mt_exit);
...@@ -54,7 +54,7 @@ static inline unsigned int connlimit_iphash(__be32 addr) ...@@ -54,7 +54,7 @@ static inline unsigned int connlimit_iphash(__be32 addr)
static inline unsigned int static inline unsigned int
connlimit_iphash6(const union nf_conntrack_address *addr, connlimit_iphash6(const union nf_conntrack_address *addr,
const union nf_conntrack_address *mask) const union nf_conntrack_address *mask)
{ {
union nf_conntrack_address res; union nf_conntrack_address res;
unsigned int i; unsigned int i;
...@@ -178,12 +178,11 @@ static int count_them(struct xt_connlimit_data *data, ...@@ -178,12 +178,11 @@ static int count_them(struct xt_connlimit_data *data,
return matches; return matches;
} }
static bool connlimit_match(const struct sk_buff *skb, static bool
const struct net_device *in, connlimit_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff,
const void *matchinfo, int offset, bool *hotdrop)
unsigned int protoff, bool *hotdrop)
{ {
const struct xt_connlimit_info *info = matchinfo; const struct xt_connlimit_info *info = matchinfo;
union nf_conntrack_address addr, mask; union nf_conntrack_address addr, mask;
...@@ -227,9 +226,10 @@ static bool connlimit_match(const struct sk_buff *skb, ...@@ -227,9 +226,10 @@ static bool connlimit_match(const struct sk_buff *skb,
return false; return false;
} }
static bool connlimit_check(const char *tablename, const void *ip, static bool
const struct xt_match *match, void *matchinfo, connlimit_mt_check(const char *tablename, const void *ip,
unsigned int hook_mask) const struct xt_match *match, void *matchinfo,
unsigned int hook_mask)
{ {
struct xt_connlimit_info *info = matchinfo; struct xt_connlimit_info *info = matchinfo;
unsigned int i; unsigned int i;
...@@ -254,7 +254,8 @@ static bool connlimit_check(const char *tablename, const void *ip, ...@@ -254,7 +254,8 @@ static bool connlimit_check(const char *tablename, const void *ip,
return true; return true;
} }
static void connlimit_destroy(const struct xt_match *match, void *matchinfo) static void
connlimit_mt_destroy(const struct xt_match *match, void *matchinfo)
{ {
struct xt_connlimit_info *info = matchinfo; struct xt_connlimit_info *info = matchinfo;
struct xt_connlimit_conn *conn; struct xt_connlimit_conn *conn;
...@@ -274,39 +275,40 @@ static void connlimit_destroy(const struct xt_match *match, void *matchinfo) ...@@ -274,39 +275,40 @@ static void connlimit_destroy(const struct xt_match *match, void *matchinfo)
kfree(info->data); kfree(info->data);
} }
static struct xt_match connlimit_reg[] __read_mostly = { static struct xt_match connlimit_mt_reg[] __read_mostly = {
{ {
.name = "connlimit", .name = "connlimit",
.family = AF_INET, .family = AF_INET,
.checkentry = connlimit_check, .checkentry = connlimit_mt_check,
.match = connlimit_match, .match = connlimit_mt,
.matchsize = sizeof(struct xt_connlimit_info), .matchsize = sizeof(struct xt_connlimit_info),
.destroy = connlimit_destroy, .destroy = connlimit_mt_destroy,
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "connlimit", .name = "connlimit",
.family = AF_INET6, .family = AF_INET6,
.checkentry = connlimit_check, .checkentry = connlimit_mt_check,
.match = connlimit_match, .match = connlimit_mt,
.matchsize = sizeof(struct xt_connlimit_info), .matchsize = sizeof(struct xt_connlimit_info),
.destroy = connlimit_destroy, .destroy = connlimit_mt_destroy,
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_connlimit_init(void) static int __init connlimit_mt_init(void)
{ {
return xt_register_matches(connlimit_reg, ARRAY_SIZE(connlimit_reg)); return xt_register_matches(connlimit_mt_reg,
ARRAY_SIZE(connlimit_mt_reg));
} }
static void __exit xt_connlimit_exit(void) static void __exit connlimit_mt_exit(void)
{ {
xt_unregister_matches(connlimit_reg, ARRAY_SIZE(connlimit_reg)); xt_unregister_matches(connlimit_mt_reg, ARRAY_SIZE(connlimit_mt_reg));
} }
module_init(xt_connlimit_init); module_init(connlimit_mt_init);
module_exit(xt_connlimit_exit); module_exit(connlimit_mt_exit);
MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>"); MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
MODULE_DESCRIPTION("netfilter xt_connlimit match module"); MODULE_DESCRIPTION("netfilter xt_connlimit match module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -32,14 +32,10 @@ MODULE_ALIAS("ipt_connmark"); ...@@ -32,14 +32,10 @@ MODULE_ALIAS("ipt_connmark");
MODULE_ALIAS("ip6t_connmark"); MODULE_ALIAS("ip6t_connmark");
static bool static bool
match(const struct sk_buff *skb, connmark_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_connmark_info *info = matchinfo; const struct xt_connmark_info *info = matchinfo;
const struct nf_conn *ct; const struct nf_conn *ct;
...@@ -53,11 +49,9 @@ match(const struct sk_buff *skb, ...@@ -53,11 +49,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, connmark_mt_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_connmark_info *cm = matchinfo; const struct xt_connmark_info *cm = matchinfo;
...@@ -74,7 +68,7 @@ checkentry(const char *tablename, ...@@ -74,7 +68,7 @@ checkentry(const char *tablename,
} }
static void static void
destroy(const struct xt_match *match, void *matchinfo) connmark_mt_destroy(const struct xt_match *match, void *matchinfo)
{ {
nf_ct_l3proto_module_put(match->family); nf_ct_l3proto_module_put(match->family);
} }
...@@ -87,7 +81,7 @@ struct compat_xt_connmark_info { ...@@ -87,7 +81,7 @@ struct compat_xt_connmark_info {
u_int16_t __pad2; u_int16_t __pad2;
}; };
static void compat_from_user(void *dst, void *src) static void connmark_mt_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_connmark_info *cm = src; const struct compat_xt_connmark_info *cm = src;
struct xt_connmark_info m = { struct xt_connmark_info m = {
...@@ -98,7 +92,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -98,7 +92,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user(void __user *dst, void *src) static int connmark_mt_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_connmark_info *m = src; const struct xt_connmark_info *m = src;
struct compat_xt_connmark_info cm = { struct compat_xt_connmark_info cm = {
...@@ -110,42 +104,42 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -110,42 +104,42 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_match xt_connmark_match[] __read_mostly = { static struct xt_match connmark_mt_reg[] __read_mostly = {
{ {
.name = "connmark", .name = "connmark",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = connmark_mt_check,
.match = match, .match = connmark_mt,
.destroy = destroy, .destroy = connmark_mt_destroy,
.matchsize = sizeof(struct xt_connmark_info), .matchsize = sizeof(struct xt_connmark_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_connmark_info), .compatsize = sizeof(struct compat_xt_connmark_info),
.compat_from_user = compat_from_user, .compat_from_user = connmark_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = connmark_mt_compat_to_user,
#endif #endif
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "connmark", .name = "connmark",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = connmark_mt_check,
.match = match, .match = connmark_mt,
.destroy = destroy, .destroy = connmark_mt_destroy,
.matchsize = sizeof(struct xt_connmark_info), .matchsize = sizeof(struct xt_connmark_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_connmark_init(void) static int __init connmark_mt_init(void)
{ {
return xt_register_matches(xt_connmark_match, return xt_register_matches(connmark_mt_reg,
ARRAY_SIZE(xt_connmark_match)); ARRAY_SIZE(connmark_mt_reg));
} }
static void __exit xt_connmark_fini(void) static void __exit connmark_mt_exit(void)
{ {
xt_unregister_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match)); xt_unregister_matches(connmark_mt_reg, ARRAY_SIZE(connmark_mt_reg));
} }
module_init(xt_connmark_init); module_init(connmark_mt_init);
module_exit(xt_connmark_fini); module_exit(connmark_mt_exit);
...@@ -20,14 +20,10 @@ MODULE_DESCRIPTION("iptables connection tracking match module"); ...@@ -20,14 +20,10 @@ MODULE_DESCRIPTION("iptables connection tracking match module");
MODULE_ALIAS("ipt_conntrack"); MODULE_ALIAS("ipt_conntrack");
static bool static bool
match(const struct sk_buff *skb, conntrack_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_conntrack_info *sinfo = matchinfo; const struct xt_conntrack_info *sinfo = matchinfo;
const struct nf_conn *ct; const struct nf_conn *ct;
...@@ -115,11 +111,9 @@ match(const struct sk_buff *skb, ...@@ -115,11 +111,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, conntrack_mt_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
if (nf_ct_l3proto_try_module_get(match->family) < 0) { if (nf_ct_l3proto_try_module_get(match->family) < 0) {
printk(KERN_WARNING "can't load conntrack support for " printk(KERN_WARNING "can't load conntrack support for "
...@@ -129,7 +123,8 @@ checkentry(const char *tablename, ...@@ -129,7 +123,8 @@ checkentry(const char *tablename,
return true; return true;
} }
static void destroy(const struct xt_match *match, void *matchinfo) static void
conntrack_mt_destroy(const struct xt_match *match, void *matchinfo)
{ {
nf_ct_l3proto_module_put(match->family); nf_ct_l3proto_module_put(match->family);
} }
...@@ -148,7 +143,7 @@ struct compat_xt_conntrack_info ...@@ -148,7 +143,7 @@ struct compat_xt_conntrack_info
u_int8_t invflags; u_int8_t invflags;
}; };
static void compat_from_user(void *dst, void *src) static void conntrack_mt_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_conntrack_info *cm = src; const struct compat_xt_conntrack_info *cm = src;
struct xt_conntrack_info m = { struct xt_conntrack_info m = {
...@@ -165,7 +160,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -165,7 +160,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user(void __user *dst, void *src) static int conntrack_mt_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_conntrack_info *m = src; const struct xt_conntrack_info *m = src;
struct compat_xt_conntrack_info cm = { struct compat_xt_conntrack_info cm = {
...@@ -183,30 +178,30 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -183,30 +178,30 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif #endif
static struct xt_match conntrack_match __read_mostly = { static struct xt_match conntrack_mt_reg __read_mostly = {
.name = "conntrack", .name = "conntrack",
.match = match, .match = conntrack_mt,
.checkentry = checkentry, .checkentry = conntrack_mt_check,
.destroy = destroy, .destroy = conntrack_mt_destroy,
.matchsize = sizeof(struct xt_conntrack_info), .matchsize = sizeof(struct xt_conntrack_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_conntrack_info), .compatsize = sizeof(struct compat_xt_conntrack_info),
.compat_from_user = compat_from_user, .compat_from_user = conntrack_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = conntrack_mt_compat_to_user,
#endif #endif
.family = AF_INET, .family = AF_INET,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init xt_conntrack_init(void) static int __init conntrack_mt_init(void)
{ {
return xt_register_match(&conntrack_match); return xt_register_match(&conntrack_mt_reg);
} }
static void __exit xt_conntrack_fini(void) static void __exit conntrack_mt_exit(void)
{ {
xt_unregister_match(&conntrack_match); xt_unregister_match(&conntrack_mt_reg);
} }
module_init(xt_conntrack_init); module_init(conntrack_mt_init);
module_exit(xt_conntrack_fini); module_exit(conntrack_mt_exit);
...@@ -93,14 +93,9 @@ match_option(u_int8_t option, const struct sk_buff *skb, unsigned int protoff, ...@@ -93,14 +93,9 @@ match_option(u_int8_t option, const struct sk_buff *skb, unsigned int protoff,
} }
static bool static bool
match(const struct sk_buff *skb, dccp_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_dccp_info *info = matchinfo; const struct xt_dccp_info *info = matchinfo;
struct dccp_hdr _dh, *dh; struct dccp_hdr _dh, *dh;
...@@ -128,11 +123,9 @@ match(const struct sk_buff *skb, ...@@ -128,11 +123,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, dccp_mt_check(const char *tablename, const void *inf,
const void *inf, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_dccp_info *info = matchinfo; const struct xt_dccp_info *info = matchinfo;
...@@ -141,12 +134,12 @@ checkentry(const char *tablename, ...@@ -141,12 +134,12 @@ checkentry(const char *tablename,
&& !(info->invflags & ~info->flags); && !(info->invflags & ~info->flags);
} }
static struct xt_match xt_dccp_match[] __read_mostly = { static struct xt_match dccp_mt_reg[] __read_mostly = {
{ {
.name = "dccp", .name = "dccp",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = dccp_mt_check,
.match = match, .match = dccp_mt,
.matchsize = sizeof(struct xt_dccp_info), .matchsize = sizeof(struct xt_dccp_info),
.proto = IPPROTO_DCCP, .proto = IPPROTO_DCCP,
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -154,15 +147,15 @@ static struct xt_match xt_dccp_match[] __read_mostly = { ...@@ -154,15 +147,15 @@ static struct xt_match xt_dccp_match[] __read_mostly = {
{ {
.name = "dccp", .name = "dccp",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = dccp_mt_check,
.match = match, .match = dccp_mt,
.matchsize = sizeof(struct xt_dccp_info), .matchsize = sizeof(struct xt_dccp_info),
.proto = IPPROTO_DCCP, .proto = IPPROTO_DCCP,
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_dccp_init(void) static int __init dccp_mt_init(void)
{ {
int ret; int ret;
...@@ -172,7 +165,7 @@ static int __init xt_dccp_init(void) ...@@ -172,7 +165,7 @@ static int __init xt_dccp_init(void)
dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL); dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL);
if (!dccp_optbuf) if (!dccp_optbuf)
return -ENOMEM; return -ENOMEM;
ret = xt_register_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match)); ret = xt_register_matches(dccp_mt_reg, ARRAY_SIZE(dccp_mt_reg));
if (ret) if (ret)
goto out_kfree; goto out_kfree;
return ret; return ret;
...@@ -182,11 +175,11 @@ static int __init xt_dccp_init(void) ...@@ -182,11 +175,11 @@ static int __init xt_dccp_init(void)
return ret; return ret;
} }
static void __exit xt_dccp_fini(void) static void __exit dccp_mt_exit(void)
{ {
xt_unregister_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match)); xt_unregister_matches(dccp_mt_reg, ARRAY_SIZE(dccp_mt_reg));
kfree(dccp_optbuf); kfree(dccp_optbuf);
} }
module_init(xt_dccp_init); module_init(dccp_mt_init);
module_exit(xt_dccp_fini); module_exit(dccp_mt_exit);
...@@ -22,14 +22,10 @@ MODULE_LICENSE("GPL"); ...@@ -22,14 +22,10 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_dscp"); MODULE_ALIAS("ipt_dscp");
MODULE_ALIAS("ip6t_dscp"); MODULE_ALIAS("ip6t_dscp");
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, dscp_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_dscp_info *info = matchinfo; const struct xt_dscp_info *info = matchinfo;
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT; u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
...@@ -37,14 +33,11 @@ static bool match(const struct sk_buff *skb, ...@@ -37,14 +33,11 @@ static bool match(const struct sk_buff *skb,
return (dscp == info->dscp) ^ !!info->invert; return (dscp == info->dscp) ^ !!info->invert;
} }
static bool match6(const struct sk_buff *skb, static bool
const struct net_device *in, dscp_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff,
const void *matchinfo, bool *hotdrop)
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_dscp_info *info = matchinfo; const struct xt_dscp_info *info = matchinfo;
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT; u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
...@@ -52,11 +45,10 @@ static bool match6(const struct sk_buff *skb, ...@@ -52,11 +45,10 @@ static bool match6(const struct sk_buff *skb,
return (dscp == info->dscp) ^ !!info->invert; return (dscp == info->dscp) ^ !!info->invert;
} }
static bool checkentry(const char *tablename, static bool
const void *info, dscp_mt_check(const char *tablename, const void *info,
const struct xt_match *match, const struct xt_match *match, void *matchinfo,
void *matchinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
const u_int8_t dscp = ((struct xt_dscp_info *)matchinfo)->dscp; const u_int8_t dscp = ((struct xt_dscp_info *)matchinfo)->dscp;
...@@ -68,34 +60,34 @@ static bool checkentry(const char *tablename, ...@@ -68,34 +60,34 @@ static bool checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match xt_dscp_match[] __read_mostly = { static struct xt_match dscp_mt_reg[] __read_mostly = {
{ {
.name = "dscp", .name = "dscp",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = dscp_mt_check,
.match = match, .match = dscp_mt,
.matchsize = sizeof(struct xt_dscp_info), .matchsize = sizeof(struct xt_dscp_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "dscp", .name = "dscp",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = dscp_mt_check,
.match = match6, .match = dscp_mt6,
.matchsize = sizeof(struct xt_dscp_info), .matchsize = sizeof(struct xt_dscp_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_dscp_match_init(void) static int __init dscp_mt_init(void)
{ {
return xt_register_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match)); return xt_register_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
} }
static void __exit xt_dscp_match_fini(void) static void __exit dscp_mt_exit(void)
{ {
xt_unregister_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match)); xt_unregister_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
} }
module_init(xt_dscp_match_init); module_init(dscp_mt_init);
module_exit(xt_dscp_match_fini); module_exit(dscp_mt_exit);
...@@ -43,14 +43,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) ...@@ -43,14 +43,9 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
} }
static bool static bool
match(const struct sk_buff *skb, esp_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct ip_esp_hdr _esp, *eh; struct ip_esp_hdr _esp, *eh;
const struct xt_esp *espinfo = matchinfo; const struct xt_esp *espinfo = matchinfo;
...@@ -75,11 +70,9 @@ match(const struct sk_buff *skb, ...@@ -75,11 +70,9 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, esp_mt_check(const char *tablename, const void *ip_void,
const void *ip_void, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_esp *espinfo = matchinfo; const struct xt_esp *espinfo = matchinfo;
...@@ -91,12 +84,12 @@ checkentry(const char *tablename, ...@@ -91,12 +84,12 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match xt_esp_match[] __read_mostly = { static struct xt_match esp_mt_reg[] __read_mostly = {
{ {
.name = "esp", .name = "esp",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = esp_mt_check,
.match = match, .match = esp_mt,
.matchsize = sizeof(struct xt_esp), .matchsize = sizeof(struct xt_esp),
.proto = IPPROTO_ESP, .proto = IPPROTO_ESP,
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -104,23 +97,23 @@ static struct xt_match xt_esp_match[] __read_mostly = { ...@@ -104,23 +97,23 @@ static struct xt_match xt_esp_match[] __read_mostly = {
{ {
.name = "esp", .name = "esp",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = esp_mt_check,
.match = match, .match = esp_mt,
.matchsize = sizeof(struct xt_esp), .matchsize = sizeof(struct xt_esp),
.proto = IPPROTO_ESP, .proto = IPPROTO_ESP,
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_esp_init(void) static int __init esp_mt_init(void)
{ {
return xt_register_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match)); return xt_register_matches(esp_mt_reg, ARRAY_SIZE(esp_mt_reg));
} }
static void __exit xt_esp_cleanup(void) static void __exit esp_mt_exit(void)
{ {
xt_unregister_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match)); xt_unregister_matches(esp_mt_reg, ARRAY_SIZE(esp_mt_reg));
} }
module_init(xt_esp_init); module_init(esp_mt_init);
module_exit(xt_esp_cleanup); module_exit(esp_mt_exit);
...@@ -441,14 +441,10 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo, ...@@ -441,14 +441,10 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
} }
static bool static bool
hashlimit_match(const struct sk_buff *skb, hashlimit_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_hashlimit_info *r = const struct xt_hashlimit_info *r =
((const struct xt_hashlimit_info *)matchinfo)->u.master; ((const struct xt_hashlimit_info *)matchinfo)->u.master;
...@@ -500,11 +496,9 @@ hashlimit_match(const struct sk_buff *skb, ...@@ -500,11 +496,9 @@ hashlimit_match(const struct sk_buff *skb,
} }
static bool static bool
hashlimit_checkentry(const char *tablename, hashlimit_mt_check(const char *tablename, const void *inf,
const void *inf, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
struct xt_hashlimit_info *r = matchinfo; struct xt_hashlimit_info *r = matchinfo;
...@@ -548,7 +542,7 @@ hashlimit_checkentry(const char *tablename, ...@@ -548,7 +542,7 @@ hashlimit_checkentry(const char *tablename,
} }
static void static void
hashlimit_destroy(const struct xt_match *match, void *matchinfo) hashlimit_mt_destroy(const struct xt_match *match, void *matchinfo)
{ {
const struct xt_hashlimit_info *r = matchinfo; const struct xt_hashlimit_info *r = matchinfo;
...@@ -563,7 +557,7 @@ struct compat_xt_hashlimit_info { ...@@ -563,7 +557,7 @@ struct compat_xt_hashlimit_info {
compat_uptr_t master; compat_uptr_t master;
}; };
static void compat_from_user(void *dst, void *src) static void hashlimit_mt_compat_from_user(void *dst, void *src)
{ {
int off = offsetof(struct compat_xt_hashlimit_info, hinfo); int off = offsetof(struct compat_xt_hashlimit_info, hinfo);
...@@ -571,7 +565,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -571,7 +565,7 @@ static void compat_from_user(void *dst, void *src)
memset(dst + off, 0, sizeof(struct compat_xt_hashlimit_info) - off); memset(dst + off, 0, sizeof(struct compat_xt_hashlimit_info) - off);
} }
static int compat_to_user(void __user *dst, void *src) static int hashlimit_mt_compat_to_user(void __user *dst, void *src)
{ {
int off = offsetof(struct compat_xt_hashlimit_info, hinfo); int off = offsetof(struct compat_xt_hashlimit_info, hinfo);
...@@ -579,33 +573,33 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -579,33 +573,33 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif #endif
static struct xt_match xt_hashlimit[] __read_mostly = { static struct xt_match hashlimit_mt_reg[] __read_mostly = {
{ {
.name = "hashlimit", .name = "hashlimit",
.family = AF_INET, .family = AF_INET,
.match = hashlimit_match, .match = hashlimit_mt,
.matchsize = sizeof(struct xt_hashlimit_info), .matchsize = sizeof(struct xt_hashlimit_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_hashlimit_info), .compatsize = sizeof(struct compat_xt_hashlimit_info),
.compat_from_user = compat_from_user, .compat_from_user = hashlimit_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = hashlimit_mt_compat_to_user,
#endif #endif
.checkentry = hashlimit_checkentry, .checkentry = hashlimit_mt_check,
.destroy = hashlimit_destroy, .destroy = hashlimit_mt_destroy,
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "hashlimit", .name = "hashlimit",
.family = AF_INET6, .family = AF_INET6,
.match = hashlimit_match, .match = hashlimit_mt,
.matchsize = sizeof(struct xt_hashlimit_info), .matchsize = sizeof(struct xt_hashlimit_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_hashlimit_info), .compatsize = sizeof(struct compat_xt_hashlimit_info),
.compat_from_user = compat_from_user, .compat_from_user = hashlimit_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = hashlimit_mt_compat_to_user,
#endif #endif
.checkentry = hashlimit_checkentry, .checkentry = hashlimit_mt_check,
.destroy = hashlimit_destroy, .destroy = hashlimit_mt_destroy,
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
...@@ -728,11 +722,12 @@ static const struct file_operations dl_file_ops = { ...@@ -728,11 +722,12 @@ static const struct file_operations dl_file_ops = {
.release = seq_release .release = seq_release
}; };
static int __init xt_hashlimit_init(void) static int __init hashlimit_mt_init(void)
{ {
int err; int err;
err = xt_register_matches(xt_hashlimit, ARRAY_SIZE(xt_hashlimit)); err = xt_register_matches(hashlimit_mt_reg,
ARRAY_SIZE(hashlimit_mt_reg));
if (err < 0) if (err < 0)
goto err1; goto err1;
...@@ -762,19 +757,19 @@ static int __init xt_hashlimit_init(void) ...@@ -762,19 +757,19 @@ static int __init xt_hashlimit_init(void)
err3: err3:
kmem_cache_destroy(hashlimit_cachep); kmem_cache_destroy(hashlimit_cachep);
err2: err2:
xt_unregister_matches(xt_hashlimit, ARRAY_SIZE(xt_hashlimit)); xt_unregister_matches(hashlimit_mt_reg, ARRAY_SIZE(hashlimit_mt_reg));
err1: err1:
return err; return err;
} }
static void __exit xt_hashlimit_fini(void) static void __exit hashlimit_mt_exit(void)
{ {
remove_proc_entry("ipt_hashlimit", init_net.proc_net); remove_proc_entry("ipt_hashlimit", init_net.proc_net);
remove_proc_entry("ip6t_hashlimit", init_net.proc_net); remove_proc_entry("ip6t_hashlimit", init_net.proc_net);
kmem_cache_destroy(hashlimit_cachep); kmem_cache_destroy(hashlimit_cachep);
xt_unregister_matches(xt_hashlimit, ARRAY_SIZE(xt_hashlimit)); xt_unregister_matches(hashlimit_mt_reg, ARRAY_SIZE(hashlimit_mt_reg));
} }
module_init(xt_hashlimit_init); module_init(hashlimit_mt_init);
module_exit(xt_hashlimit_fini); module_exit(hashlimit_mt_exit);
...@@ -24,14 +24,10 @@ MODULE_ALIAS("ip6t_helper"); ...@@ -24,14 +24,10 @@ MODULE_ALIAS("ip6t_helper");
static bool static bool
match(const struct sk_buff *skb, helper_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_helper_info *info = matchinfo; const struct xt_helper_info *info = matchinfo;
const struct nf_conn *ct; const struct nf_conn *ct;
...@@ -61,11 +57,10 @@ match(const struct sk_buff *skb, ...@@ -61,11 +57,10 @@ match(const struct sk_buff *skb,
return ret; return ret;
} }
static bool check(const char *tablename, static bool
const void *inf, helper_mt_check(const char *tablename, const void *inf,
const struct xt_match *match, const struct xt_match *match, void *matchinfo,
void *matchinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
struct xt_helper_info *info = matchinfo; struct xt_helper_info *info = matchinfo;
...@@ -78,44 +73,41 @@ static bool check(const char *tablename, ...@@ -78,44 +73,41 @@ static bool check(const char *tablename,
return true; return true;
} }
static void static void helper_mt_destroy(const struct xt_match *match, void *matchinfo)
destroy(const struct xt_match *match, void *matchinfo)
{ {
nf_ct_l3proto_module_put(match->family); nf_ct_l3proto_module_put(match->family);
} }
static struct xt_match xt_helper_match[] __read_mostly = { static struct xt_match helper_mt_reg[] __read_mostly = {
{ {
.name = "helper", .name = "helper",
.family = AF_INET, .family = AF_INET,
.checkentry = check, .checkentry = helper_mt_check,
.match = match, .match = helper_mt,
.destroy = destroy, .destroy = helper_mt_destroy,
.matchsize = sizeof(struct xt_helper_info), .matchsize = sizeof(struct xt_helper_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "helper", .name = "helper",
.family = AF_INET6, .family = AF_INET6,
.checkentry = check, .checkentry = helper_mt_check,
.match = match, .match = helper_mt,
.destroy = destroy, .destroy = helper_mt_destroy,
.matchsize = sizeof(struct xt_helper_info), .matchsize = sizeof(struct xt_helper_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_helper_init(void) static int __init helper_mt_init(void)
{ {
return xt_register_matches(xt_helper_match, return xt_register_matches(helper_mt_reg, ARRAY_SIZE(helper_mt_reg));
ARRAY_SIZE(xt_helper_match));
} }
static void __exit xt_helper_fini(void) static void __exit helper_mt_exit(void)
{ {
xt_unregister_matches(xt_helper_match, ARRAY_SIZE(xt_helper_match)); xt_unregister_matches(helper_mt_reg, ARRAY_SIZE(helper_mt_reg));
} }
module_init(xt_helper_init); module_init(helper_mt_init);
module_exit(xt_helper_fini); module_exit(helper_mt_exit);
...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_length"); ...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_length");
MODULE_ALIAS("ip6t_length"); MODULE_ALIAS("ip6t_length");
static bool static bool
match(const struct sk_buff *skb, length_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_length_info *info = matchinfo; const struct xt_length_info *info = matchinfo;
u_int16_t pktlen = ntohs(ip_hdr(skb)->tot_len); u_int16_t pktlen = ntohs(ip_hdr(skb)->tot_len);
...@@ -37,14 +33,10 @@ match(const struct sk_buff *skb, ...@@ -37,14 +33,10 @@ match(const struct sk_buff *skb,
} }
static bool static bool
match6(const struct sk_buff *skb, length_mt6(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_length_info *info = matchinfo; const struct xt_length_info *info = matchinfo;
const u_int16_t pktlen = ntohs(ipv6_hdr(skb)->payload_len) + const u_int16_t pktlen = ntohs(ipv6_hdr(skb)->payload_len) +
...@@ -53,33 +45,32 @@ match6(const struct sk_buff *skb, ...@@ -53,33 +45,32 @@ match6(const struct sk_buff *skb,
return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
} }
static struct xt_match xt_length_match[] __read_mostly = { static struct xt_match length_mt_reg[] __read_mostly = {
{ {
.name = "length", .name = "length",
.family = AF_INET, .family = AF_INET,
.match = match, .match = length_mt,
.matchsize = sizeof(struct xt_length_info), .matchsize = sizeof(struct xt_length_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "length", .name = "length",
.family = AF_INET6, .family = AF_INET6,
.match = match6, .match = length_mt6,
.matchsize = sizeof(struct xt_length_info), .matchsize = sizeof(struct xt_length_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_length_init(void) static int __init length_mt_init(void)
{ {
return xt_register_matches(xt_length_match, return xt_register_matches(length_mt_reg, ARRAY_SIZE(length_mt_reg));
ARRAY_SIZE(xt_length_match));
} }
static void __exit xt_length_fini(void) static void __exit length_mt_exit(void)
{ {
xt_unregister_matches(xt_length_match, ARRAY_SIZE(xt_length_match)); xt_unregister_matches(length_mt_reg, ARRAY_SIZE(length_mt_reg));
} }
module_init(xt_length_init); module_init(length_mt_init);
module_exit(xt_length_fini); module_exit(length_mt_exit);
...@@ -58,14 +58,10 @@ static DEFINE_SPINLOCK(limit_lock); ...@@ -58,14 +58,10 @@ static DEFINE_SPINLOCK(limit_lock);
#define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ) #define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ)
static bool static bool
ipt_limit_match(const struct sk_buff *skb, limit_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
struct xt_rateinfo *r = struct xt_rateinfo *r =
((const struct xt_rateinfo *)matchinfo)->master; ((const struct xt_rateinfo *)matchinfo)->master;
...@@ -100,11 +96,9 @@ user2credits(u_int32_t user) ...@@ -100,11 +96,9 @@ user2credits(u_int32_t user)
} }
static bool static bool
ipt_limit_checkentry(const char *tablename, limit_mt_check(const char *tablename, const void *inf,
const void *inf, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
struct xt_rateinfo *r = matchinfo; struct xt_rateinfo *r = matchinfo;
...@@ -143,7 +137,7 @@ struct compat_xt_rateinfo { ...@@ -143,7 +137,7 @@ struct compat_xt_rateinfo {
/* To keep the full "prev" timestamp, the upper 32 bits are stored in the /* To keep the full "prev" timestamp, the upper 32 bits are stored in the
* master pointer, which does not need to be preserved. */ * master pointer, which does not need to be preserved. */
static void compat_from_user(void *dst, void *src) static void limit_mt_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_rateinfo *cm = src; const struct compat_xt_rateinfo *cm = src;
struct xt_rateinfo m = { struct xt_rateinfo m = {
...@@ -157,7 +151,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -157,7 +151,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user(void __user *dst, void *src) static int limit_mt_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_rateinfo *m = src; const struct xt_rateinfo *m = src;
struct compat_xt_rateinfo cm = { struct compat_xt_rateinfo cm = {
...@@ -173,39 +167,39 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -173,39 +167,39 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_match xt_limit_match[] __read_mostly = { static struct xt_match limit_mt_reg[] __read_mostly = {
{ {
.name = "limit", .name = "limit",
.family = AF_INET, .family = AF_INET,
.checkentry = ipt_limit_checkentry, .checkentry = limit_mt_check,
.match = ipt_limit_match, .match = limit_mt,
.matchsize = sizeof(struct xt_rateinfo), .matchsize = sizeof(struct xt_rateinfo),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_rateinfo), .compatsize = sizeof(struct compat_xt_rateinfo),
.compat_from_user = compat_from_user, .compat_from_user = limit_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = limit_mt_compat_to_user,
#endif #endif
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "limit", .name = "limit",
.family = AF_INET6, .family = AF_INET6,
.checkentry = ipt_limit_checkentry, .checkentry = limit_mt_check,
.match = ipt_limit_match, .match = limit_mt,
.matchsize = sizeof(struct xt_rateinfo), .matchsize = sizeof(struct xt_rateinfo),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_limit_init(void) static int __init limit_mt_init(void)
{ {
return xt_register_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match)); return xt_register_matches(limit_mt_reg, ARRAY_SIZE(limit_mt_reg));
} }
static void __exit xt_limit_fini(void) static void __exit limit_mt_exit(void)
{ {
xt_unregister_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match)); xt_unregister_matches(limit_mt_reg, ARRAY_SIZE(limit_mt_reg));
} }
module_init(xt_limit_init); module_init(limit_mt_init);
module_exit(xt_limit_fini); module_exit(limit_mt_exit);
...@@ -25,14 +25,9 @@ MODULE_ALIAS("ipt_mac"); ...@@ -25,14 +25,9 @@ MODULE_ALIAS("ipt_mac");
MODULE_ALIAS("ip6t_mac"); MODULE_ALIAS("ip6t_mac");
static bool static bool
match(const struct sk_buff *skb, mac_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_mac_info *info = matchinfo; const struct xt_mac_info *info = matchinfo;
...@@ -44,11 +39,11 @@ match(const struct sk_buff *skb, ...@@ -44,11 +39,11 @@ match(const struct sk_buff *skb,
^ info->invert); ^ info->invert);
} }
static struct xt_match xt_mac_match[] __read_mostly = { static struct xt_match mac_mt_reg[] __read_mostly = {
{ {
.name = "mac", .name = "mac",
.family = AF_INET, .family = AF_INET,
.match = match, .match = mac_mt,
.matchsize = sizeof(struct xt_mac_info), .matchsize = sizeof(struct xt_mac_info),
.hooks = (1 << NF_INET_PRE_ROUTING) | .hooks = (1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_LOCAL_IN) | (1 << NF_INET_LOCAL_IN) |
...@@ -58,7 +53,7 @@ static struct xt_match xt_mac_match[] __read_mostly = { ...@@ -58,7 +53,7 @@ static struct xt_match xt_mac_match[] __read_mostly = {
{ {
.name = "mac", .name = "mac",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = mac_mt,
.matchsize = sizeof(struct xt_mac_info), .matchsize = sizeof(struct xt_mac_info),
.hooks = (1 << NF_INET_PRE_ROUTING) | .hooks = (1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_LOCAL_IN) | (1 << NF_INET_LOCAL_IN) |
...@@ -67,15 +62,15 @@ static struct xt_match xt_mac_match[] __read_mostly = { ...@@ -67,15 +62,15 @@ static struct xt_match xt_mac_match[] __read_mostly = {
}, },
}; };
static int __init xt_mac_init(void) static int __init mac_mt_init(void)
{ {
return xt_register_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match)); return xt_register_matches(mac_mt_reg, ARRAY_SIZE(mac_mt_reg));
} }
static void __exit xt_mac_fini(void) static void __exit mac_mt_exit(void)
{ {
xt_unregister_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match)); xt_unregister_matches(mac_mt_reg, ARRAY_SIZE(mac_mt_reg));
} }
module_init(xt_mac_init); module_init(mac_mt_init);
module_exit(xt_mac_fini); module_exit(mac_mt_exit);
...@@ -20,14 +20,9 @@ MODULE_ALIAS("ipt_mark"); ...@@ -20,14 +20,9 @@ MODULE_ALIAS("ipt_mark");
MODULE_ALIAS("ip6t_mark"); MODULE_ALIAS("ip6t_mark");
static bool static bool
match(const struct sk_buff *skb, mark_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_mark_info *info = matchinfo; const struct xt_mark_info *info = matchinfo;
...@@ -35,11 +30,9 @@ match(const struct sk_buff *skb, ...@@ -35,11 +30,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, mark_mt_check(const char *tablename, const void *entry,
const void *entry, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_mark_info *minfo = matchinfo; const struct xt_mark_info *minfo = matchinfo;
...@@ -58,7 +51,7 @@ struct compat_xt_mark_info { ...@@ -58,7 +51,7 @@ struct compat_xt_mark_info {
u_int16_t __pad2; u_int16_t __pad2;
}; };
static void compat_from_user(void *dst, void *src) static void mark_mt_compat_from_user(void *dst, void *src)
{ {
const struct compat_xt_mark_info *cm = src; const struct compat_xt_mark_info *cm = src;
struct xt_mark_info m = { struct xt_mark_info m = {
...@@ -69,7 +62,7 @@ static void compat_from_user(void *dst, void *src) ...@@ -69,7 +62,7 @@ static void compat_from_user(void *dst, void *src)
memcpy(dst, &m, sizeof(m)); memcpy(dst, &m, sizeof(m));
} }
static int compat_to_user(void __user *dst, void *src) static int mark_mt_compat_to_user(void __user *dst, void *src)
{ {
const struct xt_mark_info *m = src; const struct xt_mark_info *m = src;
struct compat_xt_mark_info cm = { struct compat_xt_mark_info cm = {
...@@ -81,39 +74,39 @@ static int compat_to_user(void __user *dst, void *src) ...@@ -81,39 +74,39 @@ static int compat_to_user(void __user *dst, void *src)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
static struct xt_match xt_mark_match[] __read_mostly = { static struct xt_match mark_mt_reg[] __read_mostly = {
{ {
.name = "mark", .name = "mark",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = mark_mt_check,
.match = match, .match = mark_mt,
.matchsize = sizeof(struct xt_mark_info), .matchsize = sizeof(struct xt_mark_info),
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_mark_info), .compatsize = sizeof(struct compat_xt_mark_info),
.compat_from_user = compat_from_user, .compat_from_user = mark_mt_compat_from_user,
.compat_to_user = compat_to_user, .compat_to_user = mark_mt_compat_to_user,
#endif #endif
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "mark", .name = "mark",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = mark_mt_check,
.match = match, .match = mark_mt,
.matchsize = sizeof(struct xt_mark_info), .matchsize = sizeof(struct xt_mark_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_mark_init(void) static int __init mark_mt_init(void)
{ {
return xt_register_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match)); return xt_register_matches(mark_mt_reg, ARRAY_SIZE(mark_mt_reg));
} }
static void __exit xt_mark_fini(void) static void __exit mark_mt_exit(void)
{ {
xt_unregister_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match)); xt_unregister_matches(mark_mt_reg, ARRAY_SIZE(mark_mt_reg));
} }
module_init(xt_mark_init); module_init(mark_mt_init);
module_exit(xt_mark_fini); module_exit(mark_mt_exit);
...@@ -34,8 +34,8 @@ MODULE_ALIAS("ip6t_multiport"); ...@@ -34,8 +34,8 @@ MODULE_ALIAS("ip6t_multiport");
/* Returns 1 if the port is matched by the test, 0 otherwise. */ /* Returns 1 if the port is matched by the test, 0 otherwise. */
static inline bool static inline bool
ports_match(const u_int16_t *portlist, enum xt_multiport_flags flags, ports_match_v0(const u_int16_t *portlist, enum xt_multiport_flags flags,
u_int8_t count, u_int16_t src, u_int16_t dst) u_int8_t count, u_int16_t src, u_int16_t dst)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -95,14 +95,10 @@ ports_match_v1(const struct xt_multiport_v1 *minfo, ...@@ -95,14 +95,10 @@ ports_match_v1(const struct xt_multiport_v1 *minfo,
} }
static bool static bool
match(const struct sk_buff *skb, multiport_mt_v0(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
__be16 _ports[2], *pptr; __be16 _ports[2], *pptr;
const struct xt_multiport *multiinfo = matchinfo; const struct xt_multiport *multiinfo = matchinfo;
...@@ -120,20 +116,15 @@ match(const struct sk_buff *skb, ...@@ -120,20 +116,15 @@ match(const struct sk_buff *skb,
return false; return false;
} }
return ports_match(multiinfo->ports, return ports_match_v0(multiinfo->ports, multiinfo->flags,
multiinfo->flags, multiinfo->count, multiinfo->count, ntohs(pptr[0]), ntohs(pptr[1]));
ntohs(pptr[0]), ntohs(pptr[1]));
} }
static bool static bool
match_v1(const struct sk_buff *skb, multiport_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
__be16 _ports[2], *pptr; __be16 _ports[2], *pptr;
const struct xt_multiport_v1 *multiinfo = matchinfo; const struct xt_multiport_v1 *multiinfo = matchinfo;
...@@ -173,11 +164,9 @@ check(u_int16_t proto, ...@@ -173,11 +164,9 @@ check(u_int16_t proto,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static bool static bool
checkentry(const char *tablename, multiport_mt_check_v0(const char *tablename, const void *info,
const void *info, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ipt_ip *ip = info; const struct ipt_ip *ip = info;
const struct xt_multiport *multiinfo = matchinfo; const struct xt_multiport *multiinfo = matchinfo;
...@@ -187,11 +176,9 @@ checkentry(const char *tablename, ...@@ -187,11 +176,9 @@ checkentry(const char *tablename,
} }
static bool static bool
checkentry_v1(const char *tablename, multiport_mt_check(const char *tablename, const void *info,
const void *info, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ipt_ip *ip = info; const struct ipt_ip *ip = info;
const struct xt_multiport_v1 *multiinfo = matchinfo; const struct xt_multiport_v1 *multiinfo = matchinfo;
...@@ -201,11 +188,9 @@ checkentry_v1(const char *tablename, ...@@ -201,11 +188,9 @@ checkentry_v1(const char *tablename,
} }
static bool static bool
checkentry6(const char *tablename, multiport_mt6_check_v0(const char *tablename, const void *info,
const void *info, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_ip6 *ip = info; const struct ip6t_ip6 *ip = info;
const struct xt_multiport *multiinfo = matchinfo; const struct xt_multiport *multiinfo = matchinfo;
...@@ -215,11 +200,9 @@ checkentry6(const char *tablename, ...@@ -215,11 +200,9 @@ checkentry6(const char *tablename,
} }
static bool static bool
checkentry6_v1(const char *tablename, multiport_mt6_check(const char *tablename, const void *info,
const void *info, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct ip6t_ip6 *ip = info; const struct ip6t_ip6 *ip = info;
const struct xt_multiport_v1 *multiinfo = matchinfo; const struct xt_multiport_v1 *multiinfo = matchinfo;
...@@ -228,13 +211,13 @@ checkentry6_v1(const char *tablename, ...@@ -228,13 +211,13 @@ checkentry6_v1(const char *tablename,
multiinfo->count); multiinfo->count);
} }
static struct xt_match xt_multiport_match[] __read_mostly = { static struct xt_match multiport_mt_reg[] __read_mostly = {
{ {
.name = "multiport", .name = "multiport",
.family = AF_INET, .family = AF_INET,
.revision = 0, .revision = 0,
.checkentry = checkentry, .checkentry = multiport_mt_check_v0,
.match = match, .match = multiport_mt_v0,
.matchsize = sizeof(struct xt_multiport), .matchsize = sizeof(struct xt_multiport),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
...@@ -242,8 +225,8 @@ static struct xt_match xt_multiport_match[] __read_mostly = { ...@@ -242,8 +225,8 @@ static struct xt_match xt_multiport_match[] __read_mostly = {
.name = "multiport", .name = "multiport",
.family = AF_INET, .family = AF_INET,
.revision = 1, .revision = 1,
.checkentry = checkentry_v1, .checkentry = multiport_mt_check,
.match = match_v1, .match = multiport_mt,
.matchsize = sizeof(struct xt_multiport_v1), .matchsize = sizeof(struct xt_multiport_v1),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
...@@ -251,8 +234,8 @@ static struct xt_match xt_multiport_match[] __read_mostly = { ...@@ -251,8 +234,8 @@ static struct xt_match xt_multiport_match[] __read_mostly = {
.name = "multiport", .name = "multiport",
.family = AF_INET6, .family = AF_INET6,
.revision = 0, .revision = 0,
.checkentry = checkentry6, .checkentry = multiport_mt6_check_v0,
.match = match, .match = multiport_mt_v0,
.matchsize = sizeof(struct xt_multiport), .matchsize = sizeof(struct xt_multiport),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
...@@ -260,24 +243,23 @@ static struct xt_match xt_multiport_match[] __read_mostly = { ...@@ -260,24 +243,23 @@ static struct xt_match xt_multiport_match[] __read_mostly = {
.name = "multiport", .name = "multiport",
.family = AF_INET6, .family = AF_INET6,
.revision = 1, .revision = 1,
.checkentry = checkentry6_v1, .checkentry = multiport_mt6_check,
.match = match_v1, .match = multiport_mt,
.matchsize = sizeof(struct xt_multiport_v1), .matchsize = sizeof(struct xt_multiport_v1),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_multiport_init(void) static int __init multiport_mt_init(void)
{ {
return xt_register_matches(xt_multiport_match, return xt_register_matches(multiport_mt_reg,
ARRAY_SIZE(xt_multiport_match)); ARRAY_SIZE(multiport_mt_reg));
} }
static void __exit xt_multiport_fini(void) static void __exit multiport_mt_exit(void)
{ {
xt_unregister_matches(xt_multiport_match, xt_unregister_matches(multiport_mt_reg, ARRAY_SIZE(multiport_mt_reg));
ARRAY_SIZE(xt_multiport_match));
} }
module_init(xt_multiport_init); module_init(multiport_mt_init);
module_exit(xt_multiport_fini); module_exit(multiport_mt_exit);
...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_physdev"); ...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_physdev");
MODULE_ALIAS("ip6t_physdev"); MODULE_ALIAS("ip6t_physdev");
static bool static bool
match(const struct sk_buff *skb, physdev_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
int i; int i;
static const char nulldevname[IFNAMSIZ]; static const char nulldevname[IFNAMSIZ];
...@@ -99,11 +95,9 @@ match(const struct sk_buff *skb, ...@@ -99,11 +95,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, physdev_mt_check(const char *tablename, const void *ip,
const void *ip, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_physdev_info *info = matchinfo; const struct xt_physdev_info *info = matchinfo;
...@@ -124,35 +118,34 @@ checkentry(const char *tablename, ...@@ -124,35 +118,34 @@ checkentry(const char *tablename,
return true; return true;
} }
static struct xt_match xt_physdev_match[] __read_mostly = { static struct xt_match physdev_mt_reg[] __read_mostly = {
{ {
.name = "physdev", .name = "physdev",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = physdev_mt_check,
.match = match, .match = physdev_mt,
.matchsize = sizeof(struct xt_physdev_info), .matchsize = sizeof(struct xt_physdev_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "physdev", .name = "physdev",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = physdev_mt_check,
.match = match, .match = physdev_mt,
.matchsize = sizeof(struct xt_physdev_info), .matchsize = sizeof(struct xt_physdev_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_physdev_init(void) static int __init physdev_mt_init(void)
{ {
return xt_register_matches(xt_physdev_match, return xt_register_matches(physdev_mt_reg, ARRAY_SIZE(physdev_mt_reg));
ARRAY_SIZE(xt_physdev_match));
} }
static void __exit xt_physdev_fini(void) static void __exit physdev_mt_exit(void)
{ {
xt_unregister_matches(xt_physdev_match, ARRAY_SIZE(xt_physdev_match)); xt_unregister_matches(physdev_mt_reg, ARRAY_SIZE(physdev_mt_reg));
} }
module_init(xt_physdev_init); module_init(physdev_mt_init);
module_exit(xt_physdev_fini); module_exit(physdev_mt_exit);
...@@ -21,14 +21,11 @@ MODULE_DESCRIPTION("IP tables match to match on linklayer packet type"); ...@@ -21,14 +21,11 @@ MODULE_DESCRIPTION("IP tables match to match on linklayer packet type");
MODULE_ALIAS("ipt_pkttype"); MODULE_ALIAS("ipt_pkttype");
MODULE_ALIAS("ip6t_pkttype"); MODULE_ALIAS("ip6t_pkttype");
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, pkttype_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff,
const void *matchinfo, bool *hotdrop)
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
u_int8_t type; u_int8_t type;
const struct xt_pkttype_info *info = matchinfo; const struct xt_pkttype_info *info = matchinfo;
...@@ -43,33 +40,32 @@ static bool match(const struct sk_buff *skb, ...@@ -43,33 +40,32 @@ static bool match(const struct sk_buff *skb,
return (type == info->pkttype) ^ info->invert; return (type == info->pkttype) ^ info->invert;
} }
static struct xt_match xt_pkttype_match[] __read_mostly = { static struct xt_match pkttype_mt_reg[] __read_mostly = {
{ {
.name = "pkttype", .name = "pkttype",
.family = AF_INET, .family = AF_INET,
.match = match, .match = pkttype_mt,
.matchsize = sizeof(struct xt_pkttype_info), .matchsize = sizeof(struct xt_pkttype_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "pkttype", .name = "pkttype",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = pkttype_mt,
.matchsize = sizeof(struct xt_pkttype_info), .matchsize = sizeof(struct xt_pkttype_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_pkttype_init(void) static int __init pkttype_mt_init(void)
{ {
return xt_register_matches(xt_pkttype_match, return xt_register_matches(pkttype_mt_reg, ARRAY_SIZE(pkttype_mt_reg));
ARRAY_SIZE(xt_pkttype_match));
} }
static void __exit xt_pkttype_fini(void) static void __exit pkttype_mt_exit(void)
{ {
xt_unregister_matches(xt_pkttype_match, ARRAY_SIZE(xt_pkttype_match)); xt_unregister_matches(pkttype_mt_reg, ARRAY_SIZE(pkttype_mt_reg));
} }
module_init(xt_pkttype_init); module_init(pkttype_mt_init);
module_exit(xt_pkttype_fini); module_exit(pkttype_mt_exit);
...@@ -108,14 +108,11 @@ match_policy_out(const struct sk_buff *skb, const struct xt_policy_info *info, ...@@ -108,14 +108,11 @@ match_policy_out(const struct sk_buff *skb, const struct xt_policy_info *info,
return strict ? i == info->len : 0; return strict ? i == info->len : 0;
} }
static bool match(const struct sk_buff *skb, static bool
const struct net_device *in, policy_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, int offset, unsigned int protoff,
const void *matchinfo, bool *hotdrop)
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_policy_info *info = matchinfo; const struct xt_policy_info *info = matchinfo;
int ret; int ret;
...@@ -133,9 +130,10 @@ static bool match(const struct sk_buff *skb, ...@@ -133,9 +130,10 @@ static bool match(const struct sk_buff *skb,
return ret; return ret;
} }
static bool checkentry(const char *tablename, const void *ip_void, static bool
const struct xt_match *match, policy_mt_check(const char *tablename, const void *ip_void,
void *matchinfo, unsigned int hook_mask) const struct xt_match *match, void *matchinfo,
unsigned int hook_mask)
{ {
struct xt_policy_info *info = matchinfo; struct xt_policy_info *info = matchinfo;
...@@ -163,37 +161,36 @@ static bool checkentry(const char *tablename, const void *ip_void, ...@@ -163,37 +161,36 @@ static bool checkentry(const char *tablename, const void *ip_void,
return true; return true;
} }
static struct xt_match xt_policy_match[] __read_mostly = { static struct xt_match policy_mt_reg[] __read_mostly = {
{ {
.name = "policy", .name = "policy",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = policy_mt_check,
.match = match, .match = policy_mt,
.matchsize = sizeof(struct xt_policy_info), .matchsize = sizeof(struct xt_policy_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "policy", .name = "policy",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = policy_mt_check,
.match = match, .match = policy_mt,
.matchsize = sizeof(struct xt_policy_info), .matchsize = sizeof(struct xt_policy_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init init(void) static int __init policy_mt_init(void)
{ {
return xt_register_matches(xt_policy_match, return xt_register_matches(policy_mt_reg, ARRAY_SIZE(policy_mt_reg));
ARRAY_SIZE(xt_policy_match));
} }
static void __exit fini(void) static void __exit policy_mt_exit(void)
{ {
xt_unregister_matches(xt_policy_match, ARRAY_SIZE(xt_policy_match)); xt_unregister_matches(policy_mt_reg, ARRAY_SIZE(policy_mt_reg));
} }
module_init(init); module_init(policy_mt_init);
module_exit(fini); module_exit(policy_mt_exit);
MODULE_ALIAS("ipt_policy"); MODULE_ALIAS("ipt_policy");
MODULE_ALIAS("ip6t_policy"); MODULE_ALIAS("ip6t_policy");
...@@ -17,10 +17,10 @@ MODULE_ALIAS("ip6t_quota"); ...@@ -17,10 +17,10 @@ MODULE_ALIAS("ip6t_quota");
static DEFINE_SPINLOCK(quota_lock); static DEFINE_SPINLOCK(quota_lock);
static bool static bool
match(const struct sk_buff *skb, quota_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct net_device *out, const struct xt_match *match,
const struct xt_match *match, const void *matchinfo, const void *matchinfo, int offset, unsigned int protoff,
int offset, unsigned int protoff, bool *hotdrop) bool *hotdrop)
{ {
struct xt_quota_info *q = struct xt_quota_info *q =
((const struct xt_quota_info *)matchinfo)->master; ((const struct xt_quota_info *)matchinfo)->master;
...@@ -40,9 +40,9 @@ match(const struct sk_buff *skb, ...@@ -40,9 +40,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, const void *entry, quota_mt_check(const char *tablename, const void *entry,
const struct xt_match *match, void *matchinfo, const struct xt_match *match, void *matchinfo,
unsigned int hook_mask) unsigned int hook_mask)
{ {
struct xt_quota_info *q = matchinfo; struct xt_quota_info *q = matchinfo;
...@@ -53,34 +53,34 @@ checkentry(const char *tablename, const void *entry, ...@@ -53,34 +53,34 @@ checkentry(const char *tablename, const void *entry,
return true; return true;
} }
static struct xt_match xt_quota_match[] __read_mostly = { static struct xt_match quota_mt_reg[] __read_mostly = {
{ {
.name = "quota", .name = "quota",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = quota_mt_check,
.match = match, .match = quota_mt,
.matchsize = sizeof(struct xt_quota_info), .matchsize = sizeof(struct xt_quota_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
{ {
.name = "quota", .name = "quota",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = quota_mt_check,
.match = match, .match = quota_mt,
.matchsize = sizeof(struct xt_quota_info), .matchsize = sizeof(struct xt_quota_info),
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_quota_init(void) static int __init quota_mt_init(void)
{ {
return xt_register_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match)); return xt_register_matches(quota_mt_reg, ARRAY_SIZE(quota_mt_reg));
} }
static void __exit xt_quota_fini(void) static void __exit quota_mt_exit(void)
{ {
xt_unregister_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match)); xt_unregister_matches(quota_mt_reg, ARRAY_SIZE(quota_mt_reg));
} }
module_init(xt_quota_init); module_init(quota_mt_init);
module_exit(xt_quota_fini); module_exit(quota_mt_exit);
...@@ -22,14 +22,10 @@ MODULE_DESCRIPTION("X_tables realm match"); ...@@ -22,14 +22,10 @@ MODULE_DESCRIPTION("X_tables realm match");
MODULE_ALIAS("ipt_realm"); MODULE_ALIAS("ipt_realm");
static bool static bool
match(const struct sk_buff *skb, realm_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_realm_info *info = matchinfo; const struct xt_realm_info *info = matchinfo;
const struct dst_entry *dst = skb->dst; const struct dst_entry *dst = skb->dst;
...@@ -37,9 +33,9 @@ match(const struct sk_buff *skb, ...@@ -37,9 +33,9 @@ match(const struct sk_buff *skb,
return (info->id == (dst->tclassid & info->mask)) ^ info->invert; return (info->id == (dst->tclassid & info->mask)) ^ info->invert;
} }
static struct xt_match realm_match __read_mostly = { static struct xt_match realm_mt_reg __read_mostly = {
.name = "realm", .name = "realm",
.match = match, .match = realm_mt,
.matchsize = sizeof(struct xt_realm_info), .matchsize = sizeof(struct xt_realm_info),
.hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) | .hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) |
(1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN), (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN),
...@@ -47,15 +43,15 @@ static struct xt_match realm_match __read_mostly = { ...@@ -47,15 +43,15 @@ static struct xt_match realm_match __read_mostly = {
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init xt_realm_init(void) static int __init realm_mt_init(void)
{ {
return xt_register_match(&realm_match); return xt_register_match(&realm_mt_reg);
} }
static void __exit xt_realm_fini(void) static void __exit realm_mt_exit(void)
{ {
xt_unregister_match(&realm_match); xt_unregister_match(&realm_mt_reg);
} }
module_init(xt_realm_init); module_init(realm_mt_init);
module_exit(xt_realm_fini); module_exit(realm_mt_exit);
...@@ -116,14 +116,9 @@ match_packet(const struct sk_buff *skb, ...@@ -116,14 +116,9 @@ match_packet(const struct sk_buff *skb,
} }
static bool static bool
match(const struct sk_buff *skb, sctp_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_sctp_info *info = matchinfo; const struct xt_sctp_info *info = matchinfo;
sctp_sctphdr_t _sh, *sh; sctp_sctphdr_t _sh, *sh;
...@@ -153,11 +148,9 @@ match(const struct sk_buff *skb, ...@@ -153,11 +148,9 @@ match(const struct sk_buff *skb,
} }
static bool static bool
checkentry(const char *tablename, sctp_mt_check(const char *tablename, const void *inf,
const void *inf, const struct xt_match *match, void *matchinfo,
const struct xt_match *match, unsigned int hook_mask)
void *matchinfo,
unsigned int hook_mask)
{ {
const struct xt_sctp_info *info = matchinfo; const struct xt_sctp_info *info = matchinfo;
...@@ -171,12 +164,12 @@ checkentry(const char *tablename, ...@@ -171,12 +164,12 @@ checkentry(const char *tablename,
| SCTP_CHUNK_MATCH_ONLY))); | SCTP_CHUNK_MATCH_ONLY)));
} }
static struct xt_match xt_sctp_match[] __read_mostly = { static struct xt_match sctp_mt_reg[] __read_mostly = {
{ {
.name = "sctp", .name = "sctp",
.family = AF_INET, .family = AF_INET,
.checkentry = checkentry, .checkentry = sctp_mt_check,
.match = match, .match = sctp_mt,
.matchsize = sizeof(struct xt_sctp_info), .matchsize = sizeof(struct xt_sctp_info),
.proto = IPPROTO_SCTP, .proto = IPPROTO_SCTP,
.me = THIS_MODULE .me = THIS_MODULE
...@@ -184,23 +177,23 @@ static struct xt_match xt_sctp_match[] __read_mostly = { ...@@ -184,23 +177,23 @@ static struct xt_match xt_sctp_match[] __read_mostly = {
{ {
.name = "sctp", .name = "sctp",
.family = AF_INET6, .family = AF_INET6,
.checkentry = checkentry, .checkentry = sctp_mt_check,
.match = match, .match = sctp_mt,
.matchsize = sizeof(struct xt_sctp_info), .matchsize = sizeof(struct xt_sctp_info),
.proto = IPPROTO_SCTP, .proto = IPPROTO_SCTP,
.me = THIS_MODULE .me = THIS_MODULE
}, },
}; };
static int __init xt_sctp_init(void) static int __init sctp_mt_init(void)
{ {
return xt_register_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match)); return xt_register_matches(sctp_mt_reg, ARRAY_SIZE(sctp_mt_reg));
} }
static void __exit xt_sctp_fini(void) static void __exit sctp_mt_exit(void)
{ {
xt_unregister_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match)); xt_unregister_matches(sctp_mt_reg, ARRAY_SIZE(sctp_mt_reg));
} }
module_init(xt_sctp_init); module_init(sctp_mt_init);
module_exit(xt_sctp_fini); module_exit(sctp_mt_exit);
...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_state"); ...@@ -21,14 +21,10 @@ MODULE_ALIAS("ipt_state");
MODULE_ALIAS("ip6t_state"); MODULE_ALIAS("ip6t_state");
static bool static bool
match(const struct sk_buff *skb, state_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_state_info *sinfo = matchinfo; const struct xt_state_info *sinfo = matchinfo;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
...@@ -44,11 +40,10 @@ match(const struct sk_buff *skb, ...@@ -44,11 +40,10 @@ match(const struct sk_buff *skb,
return (sinfo->statemask & statebit); return (sinfo->statemask & statebit);
} }
static bool check(const char *tablename, static bool
const void *inf, state_mt_check(const char *tablename, const void *inf,
const struct xt_match *match, const struct xt_match *match, void *matchinfo,
void *matchinfo, unsigned int hook_mask)
unsigned int hook_mask)
{ {
if (nf_ct_l3proto_try_module_get(match->family) < 0) { if (nf_ct_l3proto_try_module_get(match->family) < 0) {
printk(KERN_WARNING "can't load conntrack support for " printk(KERN_WARNING "can't load conntrack support for "
...@@ -58,42 +53,41 @@ static bool check(const char *tablename, ...@@ -58,42 +53,41 @@ static bool check(const char *tablename,
return true; return true;
} }
static void static void state_mt_destroy(const struct xt_match *match, void *matchinfo)
destroy(const struct xt_match *match, void *matchinfo)
{ {
nf_ct_l3proto_module_put(match->family); nf_ct_l3proto_module_put(match->family);
} }
static struct xt_match xt_state_match[] __read_mostly = { static struct xt_match state_mt_reg[] __read_mostly = {
{ {
.name = "state", .name = "state",
.family = AF_INET, .family = AF_INET,
.checkentry = check, .checkentry = state_mt_check,
.match = match, .match = state_mt,
.destroy = destroy, .destroy = state_mt_destroy,
.matchsize = sizeof(struct xt_state_info), .matchsize = sizeof(struct xt_state_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
{ {
.name = "state", .name = "state",
.family = AF_INET6, .family = AF_INET6,
.checkentry = check, .checkentry = state_mt_check,
.match = match, .match = state_mt,
.destroy = destroy, .destroy = state_mt_destroy,
.matchsize = sizeof(struct xt_state_info), .matchsize = sizeof(struct xt_state_info),
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_state_init(void) static int __init state_mt_init(void)
{ {
return xt_register_matches(xt_state_match, ARRAY_SIZE(xt_state_match)); return xt_register_matches(state_mt_reg, ARRAY_SIZE(state_mt_reg));
} }
static void __exit xt_state_fini(void) static void __exit state_mt_exit(void)
{ {
xt_unregister_matches(xt_state_match, ARRAY_SIZE(xt_state_match)); xt_unregister_matches(state_mt_reg, ARRAY_SIZE(state_mt_reg));
} }
module_init(xt_state_init); module_init(state_mt_init);
module_exit(xt_state_fini); module_exit(state_mt_exit);
This diff is collapsed.
This diff is collapsed.
...@@ -25,14 +25,10 @@ MODULE_ALIAS("ipt_tcpmss"); ...@@ -25,14 +25,10 @@ MODULE_ALIAS("ipt_tcpmss");
MODULE_ALIAS("ip6t_tcpmss"); MODULE_ALIAS("ip6t_tcpmss");
static bool static bool
match(const struct sk_buff *skb, tcpmss_mt(const struct sk_buff *skb, const struct net_device *in,
const struct net_device *in, const struct net_device *out, const struct xt_match *match,
const struct net_device *out, const void *matchinfo, int offset, unsigned int protoff,
const struct xt_match *match, bool *hotdrop)
const void *matchinfo,
int offset,
unsigned int protoff,
bool *hotdrop)
{ {
const struct xt_tcpmss_match_info *info = matchinfo; const struct xt_tcpmss_match_info *info = matchinfo;
struct tcphdr _tcph, *th; struct tcphdr _tcph, *th;
...@@ -82,11 +78,11 @@ match(const struct sk_buff *skb, ...@@ -82,11 +78,11 @@ match(const struct sk_buff *skb,
return false; return false;
} }
static struct xt_match xt_tcpmss_match[] __read_mostly = { static struct xt_match tcpmss_mt_reg[] __read_mostly = {
{ {
.name = "tcpmss", .name = "tcpmss",
.family = AF_INET, .family = AF_INET,
.match = match, .match = tcpmss_mt,
.matchsize = sizeof(struct xt_tcpmss_match_info), .matchsize = sizeof(struct xt_tcpmss_match_info),
.proto = IPPROTO_TCP, .proto = IPPROTO_TCP,
.me = THIS_MODULE, .me = THIS_MODULE,
...@@ -94,23 +90,22 @@ static struct xt_match xt_tcpmss_match[] __read_mostly = { ...@@ -94,23 +90,22 @@ static struct xt_match xt_tcpmss_match[] __read_mostly = {
{ {
.name = "tcpmss", .name = "tcpmss",
.family = AF_INET6, .family = AF_INET6,
.match = match, .match = tcpmss_mt,
.matchsize = sizeof(struct xt_tcpmss_match_info), .matchsize = sizeof(struct xt_tcpmss_match_info),
.proto = IPPROTO_TCP, .proto = IPPROTO_TCP,
.me = THIS_MODULE, .me = THIS_MODULE,
}, },
}; };
static int __init xt_tcpmss_init(void) static int __init tcpmss_mt_init(void)
{ {
return xt_register_matches(xt_tcpmss_match, return xt_register_matches(tcpmss_mt_reg, ARRAY_SIZE(tcpmss_mt_reg));
ARRAY_SIZE(xt_tcpmss_match));
} }
static void __exit xt_tcpmss_fini(void) static void __exit tcpmss_mt_exit(void)
{ {
xt_unregister_matches(xt_tcpmss_match, ARRAY_SIZE(xt_tcpmss_match)); xt_unregister_matches(tcpmss_mt_reg, ARRAY_SIZE(tcpmss_mt_reg));
} }
module_init(xt_tcpmss_init); module_init(tcpmss_mt_init);
module_exit(xt_tcpmss_fini); module_exit(tcpmss_mt_exit);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment