Browse Source

Merge pull request #20 from foosinn/master

Changes for Ubuntu 18.04
master
Maximilian Münchow 6 years ago committed by GitHub
parent
commit
f015a07a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/Makefile.xtables
  2. 4
      src/compat_xtables.h
  3. 5
      src/ts3init_match.c
  4. 6
      src/ts3init_target.c

11
src/Makefile.xtables

@ -6,7 +6,16 @@ clean: @@ -6,7 +6,16 @@ clean:
rm -f $(LIBS)
install:
install -g root -o root -m 644 $(LIBS) /lib/xtables/
if [ -d /lib/xtables ]; then \
install -g root -o root -m 644 $(LIBS) /lib/xtables/ ; \
elif [ -d /usr/lib/x86_64-linux-gnu/xtables ]; then \
install -g root -o root -m 644 $(LIBS) /usr/lib/x86_64-linux-gnu/xtables; \
elif [ -d /usr/lib/i386-linux-gnu/xtables ]; then \
install -g root -o root -m 644 $(LIBS) /usr/lib/i386-linux-gnu/xtables; \
else \
echo "Unable to find xtables modules path!"; \
exit 1; \
fi
lib%.so: lib%.o
gcc -shared -fPIC -o $@ $^;

4
src/compat_xtables.h

@ -89,7 +89,9 @@ static inline void proc_remove(struct proc_dir_entry *de) @@ -89,7 +89,9 @@ static inline void proc_remove(struct proc_dir_entry *de)
static inline struct net *par_net(const struct xt_action_param *par)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
return xt_net(par);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
return par->net;
#else
return dev_net((par->in != NULL) ? par->in : par->out);

5
src/ts3init_match.c

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
*/
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/netfilter/x_tables.h>
@ -141,7 +142,11 @@ static inline __u8* get_payload(const struct sk_buff *skb, const struct xt_actio @@ -141,7 +142,11 @@ static inline __u8* get_payload(const struct sk_buff *skb, const struct xt_actio
static int calculate_cookie(const struct sk_buff *skb, const struct xt_action_param *par,
struct udphdr *udp, __u64 k0, __u64 k1, __u64* out)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
switch (xt_family(par))
#else
switch (par->family)
#endif
{
case NFPROTO_IPV4:
{

6
src/ts3init_target.c

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
*/
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/skbuff.h>
@ -47,7 +48,12 @@ ts3init_send_ipv6_reply(struct sk_buff *oldskb, const struct xt_action_param *pa @@ -47,7 +48,12 @@ ts3init_send_ipv6_reply(struct sk_buff *oldskb, const struct xt_action_param *pa
struct udphdr *udp;
struct flowi6 fl;
struct dst_entry *dst = NULL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
struct net *net = dev_net((xt_in(par) != NULL) ? xt_in(par) : xt_out(par));
#else
struct net *net = dev_net((par->in != NULL) ? par->in : par->out);
#endif
skb = alloc_skb(LL_MAX_HEADER + sizeof(*ip) +
sizeof(*udp) + payload_size, GFP_ATOMIC);

Loading…
Cancel
Save