Browse Source

make sure all symbols that show up in the kernel are prefixed with ts3init_

pull/1/head
Niels Werensteijn 8 years ago
parent
commit
2bf9af83b9
  1. 8
      src/siphash24.c
  2. 1
      src/siphash24.h
  3. 13
      src/ts3init_match.c
  4. 14
      src/ts3init_target.c

8
src/siphash24.c

@ -25,12 +25,12 @@ enum @@ -25,12 +25,12 @@ enum
ts3init_dROUNDS = 4
};
inline u64 ts3init_ROTL(u64 x, int b)
static inline u64 ts3init_ROTL(u64 x, int b)
{
return (x << b) | (x >> (64 - b));
}
inline u64 ts3init_U8TO64_LE(const u8* p)
static inline u64 ts3init_U8TO64_LE(const u8* p)
{
return (((u64)(p[0])) | ((u64)(p[1]) << 8) |
((u64)(p[2]) << 16) | ((u64)(p[3]) << 24) |
@ -38,7 +38,7 @@ inline u64 ts3init_U8TO64_LE(const u8* p) @@ -38,7 +38,7 @@ inline u64 ts3init_U8TO64_LE(const u8* p)
((u64)(p[6]) << 48) | ((u64)(p[7]) << 56));
}
inline void ts3init_SIPROUND(u64* v0, u64* v1, u64* v2, u64* v3)
static inline void ts3init_SIPROUND(u64* v0, u64* v1, u64* v2, u64* v3)
{
*v0 += *v1;
*v1 = ts3init_ROTL(*v1, 13);
@ -57,7 +57,7 @@ inline void ts3init_SIPROUND(u64* v0, u64* v1, u64* v2, u64* v3) @@ -57,7 +57,7 @@ inline void ts3init_SIPROUND(u64* v0, u64* v1, u64* v2, u64* v3)
}
inline void ts3init_TRACE(u64 v0, u64 v1, u64 v2, u64 v3, size_t inlen)
static inline void ts3init_TRACE(u64 v0, u64 v1, u64 v2, u64 v3, size_t inlen)
{
#ifdef DEBUG
printk("(%d) v0 %x %x\n", (int)inlen, (u32)(v0 >> 32), (u32)v0);

1
src/siphash24.h

@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
#define printk printf
#define le64_to_cpu(x) x
#define cpu_to_le64(x) x
#define inline static inline
#else
#include <linux/kernel.h>
#endif

13
src/ts3init_match.c

@ -34,11 +34,11 @@ static const struct ts3_init_header_tag ts3init_header_tag_signature = @@ -34,11 +34,11 @@ static const struct ts3_init_header_tag ts3init_header_tag_signature =
{ .tag8 = {'T', 'S', '3', 'I', 'N', 'I', 'T', '1'} };
static const int header_size = 18;
static int payload_sizes[] = { 16, 20, 20, 244, -1, 1 };
static int ts3init_payload_sizes[] = { 16, 20, 20, 244, -1, 1 };
DEFINE_PER_CPU(struct ts3init_cache_t, ts3init_cache);
bool check_header(const struct sk_buff *skb, const struct xt_action_param *par,
static bool check_header(const struct sk_buff *skb, const struct xt_action_param *par,
struct ts3_init_checked_header_data* header_data)
{
unsigned int data_len;
@ -66,7 +66,7 @@ bool check_header(const struct sk_buff *skb, const struct xt_action_param *par, @@ -66,7 +66,7 @@ bool check_header(const struct sk_buff *skb, const struct xt_action_param *par,
/* TODO: check min_client_version if needed */
/* TODO: add payload size check for COMMAND_SOLVE_PUZZLE */
expected_payload_size = payload_sizes[ts3_header->command];
expected_payload_size = ts3init_payload_sizes[ts3_header->command];
if (data_len != header_size + expected_payload_size) return false;
header_data->udp = udp;
@ -239,7 +239,8 @@ static int ts3init_get_puzzle_mt_check(const struct xt_mtchk_param *par) @@ -239,7 +239,8 @@ static int ts3init_get_puzzle_mt_check(const struct xt_mtchk_param *par)
}
static struct xt_match ts3init_mt_reg[] __read_mostly = {
static struct xt_match ts3init_mt_reg[] __read_mostly =
{
{
.name = "ts3init_get_cookie",
.revision = 0,
@ -282,12 +283,12 @@ static struct xt_match ts3init_mt_reg[] __read_mostly = { @@ -282,12 +283,12 @@ static struct xt_match ts3init_mt_reg[] __read_mostly = {
},
};
int __init ts3init_match_init(void)
int ts3init_match_init(void)
{
return xt_register_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
}
void __exit ts3init_match_exit(void)
void ts3init_match_exit(void)
{
xt_unregister_matches(ts3init_mt_reg, ARRAY_SIZE(ts3init_mt_reg));
}

14
src/ts3init_target.c

@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
bool
send_ipv6(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 command, const void *payload, const size_t payload_size)
ts3init_send_ipv6(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 command, const void *payload, const size_t payload_size)
{
const struct udphdr *oldudp;
const struct ipv6hdr *oldip;
@ -113,7 +113,7 @@ send_ipv6(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 co @@ -113,7 +113,7 @@ send_ipv6(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 co
}
bool
send_ipv4(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 command, const void *payload, const size_t payload_size)
ts3init_send_ipv4(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 command, const void *payload, const size_t payload_size)
{
const struct udphdr *oldudp;
const struct iphdr *oldip;
@ -185,7 +185,7 @@ send_ipv4(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 co @@ -185,7 +185,7 @@ send_ipv4(const struct sk_buff *oldskb, const struct xt_action_param *par, u8 co
return false;
}
static const char reset_package[] = {'T', 'S', '3', 'I', 'N', 'I', 'T', '1', 0x65, 0, 0x88, COMMAND_RESET_PUZZLE, 0 };
static const char ts3init_reset_package[] = {'T', 'S', '3', 'I', 'N', 'I', 'T', '1', 0x65, 0, 0x88, COMMAND_RESET_PUZZLE, 0 };
static unsigned int
ts3init_reset_tg(struct sk_buff *skb, const struct xt_action_param *par)
@ -193,11 +193,11 @@ ts3init_reset_tg(struct sk_buff *skb, const struct xt_action_param *par) @@ -193,11 +193,11 @@ ts3init_reset_tg(struct sk_buff *skb, const struct xt_action_param *par)
switch (par->family)
{
case NFPROTO_IPV4:
send_ipv4(skb, par, COMMAND_RESET_PUZZLE, reset_package, sizeof(reset_package));
ts3init_send_ipv4(skb, par, COMMAND_RESET_PUZZLE, ts3init_reset_package, sizeof(ts3init_reset_package));
break;
case NFPROTO_IPV6:
send_ipv6(skb, par, COMMAND_RESET_PUZZLE, reset_package, sizeof(reset_package));
ts3init_send_ipv6(skb, par, COMMAND_RESET_PUZZLE, ts3init_reset_package, sizeof(ts3init_reset_package));
break;
}
return NF_DROP;
@ -223,12 +223,12 @@ static struct xt_target ts3init_tg_reg[] __read_mostly = @@ -223,12 +223,12 @@ static struct xt_target ts3init_tg_reg[] __read_mostly =
},
};
int __init ts3init_target_init(void)
int ts3init_target_init(void)
{
return xt_register_targets(ts3init_tg_reg, ARRAY_SIZE(ts3init_tg_reg));
}
void __exit ts3init_target_exit(void)
void ts3init_target_exit(void)
{
xt_unregister_targets(ts3init_tg_reg, ARRAY_SIZE(ts3init_tg_reg));
}

Loading…
Cancel
Save