***************************************************************************/
#include <linux/module.h>
+#include <linux/version.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <net/icmp.h>
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 != %lu) "
+ printk("ACCOUNT: ipt_acc_set_ctl: wrong data size (%u != %u) "
"for IPT_SO_SET_HANDLE_FREE\n",
len, sizeof(struct ipt_acc_handle_sockopt));
break;
struct ipt_acc_handle dest;
if (*len < sizeof(struct ipt_acc_handle_sockopt)) {
- printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %lu) "
+ printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u) "
"for IPT_SO_GET_ACCOUNT_PREPARE_READ/READ_FLUSH\n",
*len, sizeof(struct ipt_acc_handle_sockopt));
break;
}
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 != %lu)"
+ printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u)"
" for IPT_SO_GET_ACCOUNT_PREPARE_READ/READ_FLUSH\n",
*len, sizeof(struct ipt_acc_handle_sockopt));
break;
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 < %lu)"
+ printk("ACCOUNT: ipt_acc_get_ctl: not enough space (%u < %u)"
" 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));
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 != %lu)"
+ printk("ACCOUNT: ipt_acc_get_ctl: wrong data size (%u != %u)"
" for IPT_SO_GET_ACCOUNT_GET_HANDLE_USAGE\n",
*len, sizeof(struct ipt_acc_handle_sockopt));
break;
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+static struct xt_target xt_acc_reg = {
+#else
static struct ipt_target ipt_acc_reg = {
+#endif
.name = "ACCOUNT",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ .family = AF_INET,
+#endif
.target = ipt_acc_target,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.targetsize = sizeof(struct ipt_acc_info),
printk("ACCOUNT: Out of memory allocating account_tables structure");
goto error_cleanup;
}
- memset(ipt_acc_tables, 0,
+ memset(ipt_acc_tables, 0,
ACCOUNT_MAX_TABLES * sizeof(struct ipt_acc_table));
if ((ipt_acc_handles =
printk("ACCOUNT: Out of memory allocating account_handles structure");
goto error_cleanup;
}
- memset(ipt_acc_handles, 0,
+ memset(ipt_acc_handles, 0,
ACCOUNT_MAX_HANDLES * sizeof(struct ipt_acc_handle));
/* Allocate one page as temporary storage */
goto error_cleanup;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ if (xt_register_target(&xt_acc_reg))
+#else
if (ipt_register_target(&ipt_acc_reg))
+#endif
goto error_cleanup;
return 0;
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_target(&xt_acc_reg);
+#else
ipt_unregister_target(&ipt_acc_reg);
+#endif
nf_unregister_sockopt(&ipt_acc_sockopts);