pknock: renaming of functions and prefix-name

This commit is contained in:
Jan Rafaj
2009-09-01 19:52:48 +02:00
committed by Jan Engelhardt
parent b04317576b
commit c0dc0858de
2 changed files with 20 additions and 19 deletions

View File

@@ -902,7 +902,8 @@ is_close_knock(const struct peer *peer, const struct ipt_pknock *info,
return false; return false;
} }
static bool match(const struct sk_buff *skb, const struct xt_match_param *par) static bool pknock_mt(const struct sk_buff *skb,
const struct xt_match_param *par)
{ {
const struct ipt_pknock *info = par->matchinfo; const struct ipt_pknock *info = par->matchinfo;
struct ipt_pknock_rule *rule = NULL; struct ipt_pknock_rule *rule = NULL;
@@ -996,7 +997,7 @@ out:
#define RETURN_ERR(err) do { printk(KERN_ERR PKNOCK err); return false; } while (0) #define RETURN_ERR(err) do { printk(KERN_ERR PKNOCK err); return false; } while (0)
static bool checkentry(const struct xt_mtchk_param *par) static bool pknock_mt_check(const struct xt_mtchk_param *par)
{ {
struct ipt_pknock *info = par->matchinfo; struct ipt_pknock *info = par->matchinfo;
@@ -1061,24 +1062,24 @@ static bool checkentry(const struct xt_mtchk_param *par)
return true; return true;
} }
static void destroy(const struct xt_mtdtor_param *par) static void pknock_mt_destroy(const struct xt_mtdtor_param *par)
{ {
struct ipt_pknock *info = par->matchinfo; struct ipt_pknock *info = par->matchinfo;
/* Removes a rule only if it exits and ref_count is equal to 0. */ /* Removes a rule only if it exits and ref_count is equal to 0. */
remove_rule(info); remove_rule(info);
} }
static struct xt_match ipt_pknock_match __read_mostly = { static struct xt_match xt_pknock_mt_reg __read_mostly = {
.name = "pknock", .name = "pknock",
.family = NFPROTO_IPV4, .family = NFPROTO_IPV4,
.matchsize = sizeof (struct ipt_pknock), .matchsize = sizeof (struct ipt_pknock),
.match = match, .match = pknock_mt,
.checkentry = checkentry, .checkentry = pknock_mt_check,
.destroy = destroy, .destroy = pknock_mt_destroy,
.me = THIS_MODULE .me = THIS_MODULE
}; };
static int __init ipt_pknock_init(void) static int __init xt_pknock_mt_init(void)
{ {
printk(KERN_INFO PKNOCK "register.\n"); printk(KERN_INFO PKNOCK "register.\n");
@@ -1100,22 +1101,22 @@ static int __init ipt_pknock_init(void)
crypto.desc.tfm = crypto.tfm; crypto.desc.tfm = crypto.tfm;
crypto.desc.flags = 0; crypto.desc.flags = 0;
if (!(pde = proc_mkdir("ipt_pknock", init_net__proc_net))) { if (!(pde = proc_mkdir("xt_pknock", init_net__proc_net))) {
printk(KERN_ERR PKNOCK "proc_mkdir() error in _init().\n"); printk(KERN_ERR PKNOCK "proc_mkdir() error in _init().\n");
return -1; return -1;
} }
return xt_register_match(&ipt_pknock_match); return xt_register_match(&xt_pknock_mt_reg);
} }
static void __exit ipt_pknock_fini(void) static void __exit xt_pknock_mt_exit(void)
{ {
printk(KERN_INFO PKNOCK "unregister.\n"); printk(KERN_INFO PKNOCK "unregister.\n");
remove_proc_entry("ipt_pknock", init_net__proc_net); remove_proc_entry("xt_pknock", init_net__proc_net);
xt_unregister_match(&ipt_pknock_match); xt_unregister_match(&xt_pknock_mt_reg);
kfree(rule_hashtable); kfree(rule_hashtable);
if (crypto.tfm != NULL) crypto_free_hash(crypto.tfm); if (crypto.tfm != NULL) crypto_free_hash(crypto.tfm);
} }
module_init(ipt_pknock_init); module_init(xt_pknock_mt_init);
module_exit(ipt_pknock_fini); module_exit(xt_pknock_mt_exit);

View File

@@ -8,10 +8,10 @@
* *
* This program is released under the terms of GNU GPL version 2. * This program is released under the terms of GNU GPL version 2.
*/ */
#ifndef _IPT_PKNOCK_H #ifndef _XT_PKNOCK_H
#define _IPT_PKNOCK_H #define _XT_PKNOCK_H
#define PKNOCK "ipt_pknock: " #define PKNOCK "xt_pknock: "
#define IPT_PKNOCK_KNOCKPORT 0x01 #define IPT_PKNOCK_KNOCKPORT 0x01
#define IPT_PKNOCK_TIME 0x02 #define IPT_PKNOCK_TIME 0x02
@@ -91,4 +91,4 @@ struct transport_data {
}; };
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _IPT_PKNOCK_H */ #endif /* _XT_PKNOCK_H */