Read more about kernel namespaces and decided to go ahead with seperate object files
This commit is contained in:
parent
2e2a37d667
commit
4b157e1e2d
@ -3,6 +3,7 @@ MODULES_DIR := /lib/modules/$(shell uname -r)
|
||||
KERNEL_DIR := ${MODULES_DIR}/build
|
||||
|
||||
obj-m += xt_ts3init.o
|
||||
xt_ts3init-objs += ts3init_module.o ts3init_match.o ts3init_cookie.o siphash24.o
|
||||
|
||||
all:
|
||||
make -C ${KERNEL_DIR} M=$$PWD;
|
||||
|
@ -62,7 +62,7 @@ static void check_update_seed_cache(time_t time, __u8 index,
|
||||
crypto_free_hash(desc.tfm);
|
||||
}
|
||||
|
||||
static __u8* get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
__u8* get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
struct xt_ts3init_cookie_cache* cache,
|
||||
const __u8* cookie_seed)
|
||||
{
|
||||
|
@ -12,4 +12,8 @@ struct xt_ts3init_cookie_cache
|
||||
__u8 __attribute__((aligned(8))) seed[SHA512_SIZE*2];
|
||||
};
|
||||
|
||||
__u8* get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
struct xt_ts3init_cookie_cache* cache,
|
||||
const __u8* cookie_seed);
|
||||
|
||||
#endif /* _TS3INIT_COOKIE_H */
|
||||
|
@ -280,3 +280,12 @@ static struct xt_match ts3init_mt_reg[] __read_mostly = {
|
||||
},
|
||||
};
|
||||
|
||||
int __init ts3init_match_init(void)
|
||||
{
|
||||
return xt_register_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
|
||||
}
|
||||
|
||||
void __exit ts3init_match_exit(void)
|
||||
{
|
||||
xt_unregister_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
|
||||
}
|
||||
|
@ -2,9 +2,8 @@
|
||||
* "ts3init" extension for Xtables
|
||||
*
|
||||
* Description: A module to aid in ts3 spoof protection
|
||||
* This file just includes the actual code files so that
|
||||
* we do not have to export unneed symbols to the kernel
|
||||
* while stil organizing code into logical files.
|
||||
* This file sets up the module load and remove functions
|
||||
* and module meta data.
|
||||
*
|
||||
* Authors:
|
||||
* Niels Werensteijn <niels werensteijn [at] teampseak com>, 2016-10-03
|
||||
@ -14,9 +13,12 @@
|
||||
* or 3 of the License, as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include "siphash24.c"
|
||||
#include "ts3init_cookie.c"
|
||||
#include "ts3init_match.c"
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netfilter/x_tables.h>
|
||||
|
||||
/* defined in ts3init_match.c */
|
||||
int __init ts3init_match_init(void);
|
||||
void __exit ts3init_match_exit(void);
|
||||
|
||||
MODULE_AUTHOR("Niels Werensteijn <niels.werensteijn@teamspeak.com>");
|
||||
MODULE_DESCRIPTION("A module to aid in ts3 spoof protection");
|
||||
@ -24,15 +26,15 @@ MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("ipt_ts3init");
|
||||
MODULE_ALIAS("ip6t_ts3init");
|
||||
|
||||
static int __init ts3init_mt_init(void)
|
||||
static int __init ts3init_init(void)
|
||||
{
|
||||
return xt_register_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
|
||||
return ts3init_match_init();
|
||||
}
|
||||
|
||||
static void __exit ts3init_mt_exit(void)
|
||||
static void __exit ts3init_exit(void)
|
||||
{
|
||||
xt_unregister_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
|
||||
ts3init_match_exit();
|
||||
}
|
||||
|
||||
module_init(ts3init_mt_init);
|
||||
module_exit(ts3init_mt_exit);
|
||||
module_init(ts3init_init);
|
||||
module_exit(ts3init_exit);
|
Loading…
x
Reference in New Issue
Block a user