--- ../patch-o-matic-ng/patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c.orig 2007-05-02 15:32:00.000000000 +0200 +++ ../patch-o-matic-ng/patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c 2007-09-13 13:08:45.000000000 +0200 @@ -18,6 +18,8 @@ #include #include +#include + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Fabrice Marie "); @@ -32,7 +34,11 @@ int *hotdrop) { const struct ipt_ipv4options_info *info = matchinfo; /* match info for rule */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + const struct iphdr *iph = ip_hdr(skb); +#else const struct iphdr *iph = skb->nh.iph; +#endif const struct ip_options *opt; if (iph->ihl * 4 == sizeof(struct iphdr)) { @@ -110,13 +116,17 @@ const void *ip, const struct xt_match *match, void *matchinfo, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) unsigned int matchsize, +#endif unsigned int hook_mask) { const struct ipt_ipv4options_info *info = matchinfo; /* match info for rule */ /* Check the size */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) if (matchsize != IPT_ALIGN(sizeof(struct ipt_ipv4options_info))) return 0; +#endif /* Now check the coherence of the data ... */ if (((info->options & IPT_IPV4OPTION_MATCH_ANY_OPT) == IPT_IPV4OPTION_MATCH_ANY_OPT) && (((info->options & IPT_IPV4OPTION_DONT_MATCH_SRR) == IPT_IPV4OPTION_DONT_MATCH_SRR) || @@ -154,8 +164,15 @@ return 1; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct xt_match ipv4options_match = { +#else static struct ipt_match ipv4options_match = { +#endif .name = "ipv4options", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + .family = AF_INET, +#endif .match = match, .matchsize = sizeof(struct ipt_ipv4options_info), .checkentry = checkentry, @@ -164,12 +181,20 @@ static int __init init(void) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + return xt_register_match(&ipv4options_match); +#else return ipt_register_match(&ipv4options_match); +#endif } static void __exit fini(void) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + xt_unregister_match(&ipv4options_match); +#else ipt_unregister_match(&ipv4options_match); +#endif } module_init(init);