X-Git-Url: http://developer.intra2net.com/git/?p=ipt_ACCOUNT;a=blobdiff_plain;f=linux-2.6%2Fnet%2Fipv4%2Fnetfilter%2Fipt_ACCOUNT.c;h=5d01b96b08654bb35f24b377606f0c92340f84e3;hp=48073e5e1eb57f521649cef27caa65a953431d63;hb=51e0e79736c53b330b929b3efbf24f0f34b95512;hpb=946762ae354f5a0fb4d4fb20d8cc8880fa42092f diff --git a/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c b/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c index 48073e5..5d01b96 100644 --- a/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c +++ b/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c @@ -3,7 +3,7 @@ * See http://www.intra2net.com/opensource/ipt_account * * for further information * * * - * Copyright (C) 2004-2006 by Intra2net AG * + * Copyright (C) 2004-2007 by Intra2net AG * * opensource@intra2net.com * * * * This program is free software; you can redistribute it and/or modify * @@ -200,7 +200,11 @@ static int ipt_acc_table_insert(char *name, u_int32_t ip, u_int32_t netmask) return -1; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) +static bool ipt_acc_checkentry(const char *tablename, +#else static int ipt_acc_checkentry(const char *tablename, +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) const void *e, #else @@ -233,13 +237,21 @@ static int ipt_acc_checkentry(const char *tablename, if (table_nr == -1) { printk("ACCOUNT: Table insert problem. Aborting\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + return false; +#else return 0; +#endif } /* Table nr caching so we don't have to do an extra string compare for every packet */ info->table_nr = table_nr; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + return true; +#else return 1; +#endif } static void ipt_acc_destroy( @@ -449,7 +461,11 @@ static void ipt_acc_depth2_insert(struct ipt_acc_mask_8 *mask_8, } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) +static unsigned int ipt_acc_target(struct sk_buff *skb, +#else static unsigned int ipt_acc_target(struct sk_buff **pskb, +#endif const struct net_device *in, const struct net_device *out, unsigned int hooknum, @@ -465,6 +481,11 @@ static unsigned int ipt_acc_target(struct sk_buff **pskb, { const struct ipt_acc_info *info = (const struct ipt_acc_info *)targinfo; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + u_int32_t src_ip = ip_hdr(skb)->saddr; + u_int32_t dst_ip = ip_hdr(skb)->daddr; + u_int32_t size = ntohs(ip_hdr(skb)->tot_len); +#else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) u_int32_t src_ip = ip_hdr(*pskb)->saddr; u_int32_t dst_ip = ip_hdr(*pskb)->daddr; @@ -474,6 +495,7 @@ static unsigned int ipt_acc_target(struct sk_buff **pskb, u_int32_t dst_ip = (*pskb)->nh.iph->daddr; u_int32_t size = ntohs((*pskb)->nh.iph->tot_len); #endif +#endif spin_lock_bh(&ipt_acc_lock); @@ -867,7 +889,7 @@ static int ipt_acc_set_ctl(struct sock *sk, int cmd, switch (cmd) { case IPT_SO_SET_ACCOUNT_HANDLE_FREE: if (len != sizeof(struct ipt_acc_handle_sockopt)) { - printk("ACCOUNT: ipt_acc_set_ctl: wrong data size (%u != %u) " + printk("ACCOUNT: ipt_acc_set_ctl: wrong data size (%u != %zu) " "for IPT_SO_SET_HANDLE_FREE\n", len, sizeof(struct ipt_acc_handle_sockopt)); break; @@ -913,7 +935,7 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len) struct ipt_acc_handle dest; if (*len < sizeof(struct ipt_acc_handle_sockopt)) { - printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u) " + printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %zu) " "for IPT_SO_GET_ACCOUNT_PREPARE_READ/READ_FLUSH\n", *len, sizeof(struct ipt_acc_handle_sockopt)); break; @@ -958,7 +980,7 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len) } case IPT_SO_GET_ACCOUNT_GET_DATA: if (*len < sizeof(struct ipt_acc_handle_sockopt)) { - printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u)" + printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %zu)" " for IPT_SO_GET_ACCOUNT_PREPARE_READ/READ_FLUSH\n", *len, sizeof(struct ipt_acc_handle_sockopt)); break; @@ -977,7 +999,7 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len) if (*len < ipt_acc_handles[handle.handle_nr].itemcount * sizeof(struct ipt_acc_handle_ip)) { - printk("ACCOUNT: ipt_acc_get_ctl: not enough space (%u < %u)" + printk("ACCOUNT: ipt_acc_get_ctl: not enough space (%u < %zu)" " to store data from IPT_SO_GET_ACCOUNT_GET_DATA\n", *len, ipt_acc_handles[handle.handle_nr].itemcount * sizeof(struct ipt_acc_handle_ip)); @@ -999,7 +1021,7 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len) case IPT_SO_GET_ACCOUNT_GET_HANDLE_USAGE: { unsigned int i; if (*len < sizeof(struct ipt_acc_handle_sockopt)) { - printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u)" + printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %zu)" " for IPT_SO_GET_ACCOUNT_GET_HANDLE_USAGE\n", *len, sizeof(struct ipt_acc_handle_sockopt)); break;