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=5a5f03ffa5d6f67285c81503dcd58504d5a08251;hp=78ae9263d54628bdd7ece84d03446343a2c5ddd6;hb=32efca6f6d8fa23b3654a875a33fefa121982d08;hpb=8396f52579b6c9c77792e28a75360d17e50bdfaa diff --git a/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c b/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c index 78ae926..5a5f03f 100644 --- a/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c +++ b/linux-2.6/net/ipv4/netfilter/ipt_ACCOUNT.c @@ -453,9 +453,15 @@ 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,22) + u_int32_t src_ip = ip_hdr(*pskb)->saddr; + u_int32_t dst_ip = ip_hdr(*pskb)->daddr; + u_int32_t size = ntohs(ip_hdr(*pskb)->tot_len); +#else u_int32_t src_ip = (*pskb)->nh.iph->saddr; u_int32_t dst_ip = (*pskb)->nh.iph->daddr; u_int32_t size = ntohs((*pskb)->nh.iph->tot_len); +#endif spin_lock_bh(&ipt_acc_lock); @@ -1051,8 +1057,15 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len) 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), @@ -1082,7 +1095,7 @@ static int __init init(void) 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 = @@ -1091,7 +1104,7 @@ static int __init init(void) 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 */ @@ -1106,7 +1119,11 @@ static int __init init(void) 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; @@ -1124,7 +1141,11 @@ error_cleanup: 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);