1 diff -ur linuxigd-1.0.orig/iptc.c linuxigd-1.0/iptc.c
2 --- linuxigd-1.0.orig/iptc.c 2009-05-05 14:01:59.000000000 +0200
3 +++ linuxigd-1.0/iptc.c 2009-05-05 14:05:48.000000000 +0200
6 #include <libiptc/libiptc.h>
7 #include <linux/version.h>
8 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
9 -#include <linux/netfilter/nf_nat.h>
11 +# include <net/netfilter/nf_nat.h>
12 +# define ip_nat_multi_range nf_nat_multi_range_compat
13 +# define ip_nat_range nf_nat_range
15 -#include <linux/netfilter_ipv4/ip_nat.h>
16 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
17 +# include <linux/netfilter/nf_nat.h>
19 +# include <linux/netfilter_ipv4/ip_nat.h>
22 #include <arpa/inet.h> /* inet_addr */
27 +#define IPTC_HANDLE struct iptc_handle *
31 struct ipt_entry_target t;
36 - iptc_handle_t handle;
38 struct ipt_entry *chain_entry;
39 struct ipt_entry_match *entry_match = NULL;
40 struct ipt_entry_target *entry_target = NULL;
45 - result = iptc_append_entry(labelit, chain_entry, &handle);
46 + result = iptc_append_entry(labelit, chain_entry, handle);
48 - result = iptc_insert_entry(labelit, chain_entry, 0, &handle);
49 + result = iptc_insert_entry(labelit, chain_entry, 0, handle);
52 trace(1, "libiptc error: Can't add, %s", iptc_strerror(errno));
55 - result = iptc_commit(&handle);
56 + result = iptc_commit(handle);
58 trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
64 - iptc_handle_t handle;
66 const struct ipt_entry *e;
67 ipt_chainlabel labelit;
72 /* check through rules to find match */
73 - for (e = iptc_first_rule(chain, &handle), i=0; e; e = iptc_next_rule(e, &handle), i++) {
74 + for (e = iptc_first_rule(chain, handle), i=0; e; e = iptc_next_rule(e, handle), i++) {
75 if (s_src != INADDR_NONE && e->ip.src.s_addr != s_src) continue;
76 if (s_dest != INADDR_NONE && e->ip.dst.s_addr != s_dest) continue;
77 if (iniface && strcmp(e->ip.iniface, iniface) != 0) continue;
79 if (protocol && strcmp(protocol, "TCP") == 0 && e->ip.proto != IPPROTO_TCP) continue;
80 if (protocol && strcmp(protocol, "UDP") == 0 && e->ip.proto != IPPROTO_UDP) continue;
81 if ((srcports || destports) && IPT_MATCH_ITERATE(e, matchcmp, srcports, destports) == 0) continue;
82 - if (target && strcmp(target, iptc_get_target(e, &handle)) != 0) continue;
83 + if (target && strcmp(target, iptc_get_target(e, handle)) != 0) continue;
84 if (dnat_to && strcmp(target, "DNAT") == 0) {
85 struct ipt_entry_target *t;
86 struct ip_nat_multi_range *mr;
91 - result = iptc_delete_num_entry(chain, i, &handle);
92 + result = iptc_delete_num_entry(chain, i, handle);
94 trace(1, "libiptc error: Delete error, %s", iptc_strerror(errno));
97 - result = iptc_commit(&handle);
98 + result = iptc_commit(handle);
100 trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));