mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-05 20:26:38 +02:00
build: support for Linux 3.2
This commit is contained in:
@@ -10,7 +10,9 @@ AC_PROG_LIBTOOL
|
||||
|
||||
AC_ARG_WITH([kbuild],
|
||||
AS_HELP_STRING([--with-kbuild=PATH],
|
||||
[Path to kernel build directory [[/lib/modules/CURRENT/build]]]),
|
||||
[Path to kernel build directory [[/lib/modules/CURRENT/build]]])
|
||||
AS_HELP_STRING([--without-kbuild],
|
||||
[Build only userspace tools]),
|
||||
[kbuilddir="$withval"],
|
||||
[kbuilddir="/lib/modules/$(uname -r)/build"])
|
||||
#
|
||||
@@ -60,7 +62,7 @@ if test -n "$kbuilddir"; then
|
||||
echo "WARNING: Version detection did not succeed. Continue at own luck.";
|
||||
else
|
||||
echo "$kmajor.$kminor.$kmicro.$kstable in $kbuilddir";
|
||||
if test "$kmajor" -gt 3 -o "$kmajor" -eq 3 -a "$kminor" -gt 1; then
|
||||
if test "$kmajor" -gt 3 -o "$kmajor" -eq 3 -a "$kminor" -gt 2; then
|
||||
echo "WARNING: You are trying a newer kernel. Results may vary. :-)";
|
||||
elif test "$kmajor" -eq 3; then
|
||||
:;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
HEAD
|
||||
====
|
||||
Enhancements:
|
||||
- Support for Linux 3.2
|
||||
|
||||
|
||||
v1.40 (2011-11-30)
|
||||
|
@@ -92,6 +92,12 @@
|
||||
# define rt_dst(rt) (&(rt)->u.dst)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
|
||||
# define nf_nat_ipv4_multi_range_compat nf_nat_multi_range_compat
|
||||
# define nf_nat_ipv4_range nf_nat_range
|
||||
# define NF_NAT_RANGE_MAP_IPS IP_NAT_RANGE_MAP_IPS
|
||||
#endif
|
||||
|
||||
#if !defined(NIP6) && !defined(NIP6_FMT)
|
||||
# define NIP6(addr) \
|
||||
ntohs((addr).s6_addr16[0]), \
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <linux/icmp.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <linux/sctp.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipv6.h>
|
||||
@@ -115,9 +116,14 @@ ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
||||
{
|
||||
int protoff;
|
||||
u8 nexthdr;
|
||||
__be16 frag_off;
|
||||
|
||||
nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
|
||||
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
|
||||
#else
|
||||
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr, &frag_off);
|
||||
#endif
|
||||
if (protoff < 0)
|
||||
return false;
|
||||
|
||||
|
@@ -241,7 +241,7 @@ hash_ip6_data_isnull(const struct hash_ip6_elem *elem)
|
||||
static inline void
|
||||
hash_ip6_data_copy(struct hash_ip6_elem *dst, const struct hash_ip6_elem *src)
|
||||
{
|
||||
ipv6_addr_copy(&dst->ip.in6, &src->ip.in6);
|
||||
dst->ip.in6 = src->ip.in6;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@@ -267,7 +267,7 @@ static inline void
|
||||
hash_net6_data_copy(struct hash_net6_elem *dst,
|
||||
const struct hash_net6_elem *src)
|
||||
{
|
||||
ipv6_addr_copy(&dst->ip.in6, &src->ip.in6);
|
||||
dst->ip.in6 = src->ip.in6;
|
||||
dst->cidr = src->cidr;
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ struct dnetmap_entry {
|
||||
};
|
||||
|
||||
struct dnetmap_prefix {
|
||||
struct nf_nat_multi_range_compat prefix;
|
||||
struct nf_nat_ipv4_multi_range_compat prefix;
|
||||
char prefix_str[16];
|
||||
struct list_head list;
|
||||
unsigned int refcnt;
|
||||
@@ -154,7 +154,7 @@ dnetmap_entry_rlookup(struct dnetmap_net *dnetmap_net, const __be32 addr)
|
||||
|
||||
static struct dnetmap_prefix *
|
||||
dnetmap_prefix_lookup(struct dnetmap_net *dnetmap_net,
|
||||
const struct nf_nat_multi_range_compat *mr)
|
||||
const struct nf_nat_ipv4_multi_range_compat *mr)
|
||||
{
|
||||
struct dnetmap_prefix *p;
|
||||
|
||||
@@ -194,7 +194,7 @@ static int dnetmap_tg_check(const struct xt_tgchk_param *par)
|
||||
{
|
||||
struct dnetmap_net *dnetmap_net = dnetmap_pernet(par->net);
|
||||
const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
|
||||
const struct nf_nat_multi_range_compat *mr = &tginfo->prefix;
|
||||
const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
|
||||
struct dnetmap_prefix *p;
|
||||
struct dnetmap_entry *e;
|
||||
#ifdef CONFIG_PROC_FS
|
||||
@@ -213,7 +213,7 @@ static int dnetmap_tg_check(const struct xt_tgchk_param *par)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!(mr->range[0].flags & IP_NAT_RANGE_MAP_IPS)) {
|
||||
if (!(mr->range[0].flags & NF_NAT_RANGE_MAP_IPS)) {
|
||||
pr_debug("DNETMAP:check: bad MAP_IPS.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -316,8 +316,8 @@ dnetmap_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
||||
enum ip_conntrack_info ctinfo;
|
||||
__be32 prenat_ip, postnat_ip, prenat_ip_prev;
|
||||
const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
|
||||
const struct nf_nat_multi_range_compat *mr = &tginfo->prefix;
|
||||
struct nf_nat_range newrange;
|
||||
const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
|
||||
struct nf_nat_ipv4_range newrange;
|
||||
struct dnetmap_entry *e;
|
||||
struct dnetmap_prefix *p;
|
||||
__s32 jttl;
|
||||
@@ -354,8 +354,8 @@ dnetmap_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
||||
|
||||
spin_unlock_bh(&dnetmap_lock);
|
||||
|
||||
newrange = ((struct nf_nat_range) {
|
||||
mr->range[0].flags | IP_NAT_RANGE_MAP_IPS,
|
||||
newrange = ((struct nf_nat_ipv4_range) {
|
||||
mr->range[0].flags | NF_NAT_RANGE_MAP_IPS,
|
||||
e->prenat_addr, e->prenat_addr,
|
||||
mr->range[0].min, mr->range[0].max});
|
||||
|
||||
@@ -440,8 +440,8 @@ bind_new_prefix:
|
||||
|
||||
spin_unlock_bh(&dnetmap_lock);
|
||||
|
||||
newrange = ((struct nf_nat_range) {
|
||||
mr->range[0].flags | IP_NAT_RANGE_MAP_IPS,
|
||||
newrange = ((struct nf_nat_ipv4_range) {
|
||||
mr->range[0].flags | NF_NAT_RANGE_MAP_IPS,
|
||||
postnat_ip, postnat_ip,
|
||||
mr->range[0].min, mr->range[0].max});
|
||||
|
||||
@@ -459,7 +459,7 @@ static void dnetmap_tg_destroy(const struct xt_tgdtor_param *par)
|
||||
{
|
||||
struct dnetmap_net *dnetmap_net = dnetmap_pernet(par->net);
|
||||
const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
|
||||
const struct nf_nat_multi_range_compat *mr = &tginfo->prefix;
|
||||
const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
|
||||
struct dnetmap_prefix *p;
|
||||
#ifdef CONFIG_PROC_FS
|
||||
char str[25];
|
||||
|
@@ -8,7 +8,7 @@ enum {
|
||||
};
|
||||
|
||||
struct xt_DNETMAP_tginfo {
|
||||
struct nf_nat_multi_range_compat prefix;
|
||||
struct nf_nat_ipv4_multi_range_compat prefix;
|
||||
__u8 flags;
|
||||
__s16 ttl;
|
||||
};
|
||||
|
Reference in New Issue
Block a user