patches against 2.6.21 and a small script
Hi list!
I found that many pom patches are out of date so I "upgraded" them...
And also attached a small diff script. (Just rename the old source to .orig and you will get all of those modifications you did if you run this script.)
Swifty
Patches:
patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c renamed from patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c.orig +0 -0
@@ -154,8 +154,16 @@
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",
+ .family = AF_INET,
+#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 +172,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);
patchlets/ROUTE/linux-2.6/net/ipv4/netfilter/ipt_ROUTE.c renamed from patchlets/ROUTE/linux-2.6/net/ipv4/netfilter/ipt_ROUTE.c.orig +0 -0
@@ -452,8 +452,15 @@
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct xt_target xt_route_reg = { +#else static struct ipt_target ipt_route_reg = { +#endif
.name = "ROUTE",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ .family = AF_INET,
+#endif
.target = ipt_route_target,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.targetsize = sizeof(struct ipt_route_target_info),
@@ -471,14 +478,21 @@
set_bit(IPS_CONFIRMED_BIT, &route_tee_track.status); /* Initialize fake conntrack so that NAT will skip it */ route_tee_track.status |= IPS_NAT_DONE_MASK;
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_target(&xt_route_reg);
+#else
return ipt_register_target(&ipt_route_reg);
+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_target(&xt_route_reg);
+#else
ipt_unregister_target(&ipt_route_reg);
+#endif
}
module_init(init);
patchlets/IPV4OPTSSTRIP/linux-2.6/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c renamed from patchlets/IPV4OPTSSTRIP/linux-2.6/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c.orig +0 -0
@@ -30,7 +30,7 @@
unsigned char *optiph; int l;
- if (!skb_ip_make_writable(pskb, (*pskb)->len))
+ if (!skb_make_writable(pskb, (*pskb)->len))
return NF_DROP; skb = (*pskb); @@ -67,20 +67,36 @@ return 1; }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct xt_target xt_ipv4optsstrip_reg = { +#else static struct ipt_target ipt_ipv4optsstrip_reg = { +#endif
.name = "IPV4OPTSSTRIP",
+ .family = AF_INET,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ .family = AF_INET,
+#endif
.target = target,
.checkentry = checkentry,
.me = THIS_MODULE };
static int __init init(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_target(&xt_ipv4optsstrip_reg);
+#else
return ipt_register_target(&ipt_ipv4optsstrip_reg);
+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_target(&xt_ipv4optsstrip_reg);
+#else
ipt_unregister_target(&ipt_ipv4optsstrip_reg);
+#endif
}
module_init(init);
patchlets/geoip/linux-2.6/net/ipv4/netfilter/ipt_geoip.c renamed from patchlets/geoip/linux-2.6/net/ipv4/netfilter/ipt_geoip.c.orig +0 -0
@@ -275,8 +275,15 @@return ;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+static struct xt_match geoip_match = {
+#else
static struct ipt_match geoip_match = {
+#endif
.name = "geoip",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ .family = AF_INET,
+#endif
.match = &match,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.matchsize = sizeof (struct ipt_geoip_info),
@@ -288,12 +295,20 @@
static int __init init(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_match(&geoip_match);
+#else
return ipt_register_match(&geoip_match);
+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_match(&geoip_match);
+#else
ipt_unregister_match(&geoip_match);
+#endif
return;
}
patchlets/IPMARK/linux-2.6/net/ipv4/netfilter/ipt_IPMARK.c renamed from patchlets/IPMARK/linux-2.6/net/ipv4/netfilter/ipt_IPMARK.c.orig +0 -0
@@ -82,8 +82,15 @@
return 1; }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct xt_target xt_ipmark_reg = { +#else static struct ipt_target ipt_ipmark_reg = { +#endif
.name = "IPMARK", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + .family = AF_INET, +#endif .target = target,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.targetsize = sizeof(struct ipt_ipmark_target_info),
@@ -94,12 +101,20 @@
static int __init init(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_target(&xt_ipmark_reg);
+#else
return ipt_register_target(&ipt_ipmark_reg);
+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_target(&xt_ipmark_reg);
+#else
ipt_unregister_target(&ipt_ipmark_reg);
+#endif
}
module_init(init);
patchlets/connlimit/linux-2.6/net/ipv4/netfilter/ipt_connlimit.c renamed from patchlets/connlimit/linux-2.6/net/ipv4/netfilter/ipt_connlimit.c.orig +0 -0
@@ -291,8 +291,15 @@
kfree(info->data); }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct xt_match connlimit_match = { +#else static struct ipt_match connlimit_match = { +#endif
.name = "connlimit", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + .family = AF_INET, +#endif .match = &match,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.matchsize = sizeof(struct ipt_connlimit_info),
@@ -304,12 +311,20 @@
static int __init init(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_match(&connlimit_match);
+#else
return ipt_register_match(&connlimit_match);
+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_match(&connlimit_match);
+#else
ipt_unregister_match(&connlimit_match);
+#endif
}
module_init(init);
patchlets/ipp2p/linux-2.6/net/ipv4/netfilter/ipt_ipp2p.c renamed from patchlets/ipp2p/linux-2.6/net/ipv4/netfilter/ipt_ipp2p.c.orig +0 -0
@@ -844,8 +844,11 @@
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+static struct xt_match ipp2p_match = { +#else
static struct ipt_match ipp2p_match = { +#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
{ NULL, NULL },
"ipp2p",
@@ -856,6 +859,9 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.name = "ipp2p",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ .family = AF_INET,
+#endif
.match = &match,#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.matchsize = sizeof(struct ipt_p2p_info),
@@ -869,12 +875,20 @@
static int __init init(void)
{
printk(KERN_INFO "IPP2P v%s loading\n", IPP2P_VERSION);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_match(&ipp2p_match);
+#else
return ipt_register_match(&ipp2p_match);+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_match(&ipp2p_match);
+#else
ipt_unregister_match(&ipp2p_match);
+#endif
printk(KERN_INFO "IPP2P v%s unloaded\n", IPP2P_VERSION);
}patchlets/time/linux-2.6/net/ipv4/netfilter/ipt_time.c renamed from patchlets/time/linux-2.6/net/ipv4/netfilter/ipt_time.c.orig +0 -0
@@ -126,8 +126,15 @@
return 1; }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+static struct xt_match time_match = {
+#else
static struct ipt_match time_match = {
+#endif
.name = "time", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + .family = AF_INET, +#endif .match = &match,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
.matchsize = sizeof(struct ipt_time_info),
@@ -139,12 +146,20 @@
static int __init init(void)
{
printk("ipt_time loading\n");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ return xt_register_match(&time_match);
+#else
return ipt_register_match(&time_match);+#endif
}
static void __exit fini(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+ xt_unregister_match(&time_match);
+#else
ipt_unregister_match(&time_match);
+#endif
printk("ipt_time unloaded\n");
}Diff script:
#!/bin/bash
for f in find . | grep .orig
do diff -Nru $f echo $f | sed 's/.orig//'
done
Hi,
From: Gáspár Lajos <[email protected]>
Date: Mon, 25 Jun 2007 19:04:10 +0200
Quoted 6 lines
Hi list!
I found that many pom patches are out of date so I "upgraded" them... And also attached a small diff script. (Just rename the old source to .orig and you will get all of those modifications you did if you run this script.)
Thanks, please post such patches to netfilter-devel list from next time.
patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c line 161
Quoted 11 lines
patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c renamed from patchlets/ipv4options/linux-2.6/net/ipv4/netfilter/ipt_ipv4options.c.orig +4
-0@@ -154,8 +154,16 @@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
You don't need to support old kernel in one file. Please assume that you are writing for only the recent kernel.
patchlets/connlimit/linux-2.6/net/ipv4/netfilter/ipt_connlimit.c
Quoted 2 lines
patchlets/connlimit/linux-2.6/net/ipv4/netfilter/ipt_connlimit.c renamed from patchlets/connlimit/linux-2.6/net/ipv4/netfilter/ipt_connlimit.c.orig +0
-0
Jan Engelhardt is improving connlimit match. Please refer netfilter-devel archive in detail.
-- Yasuyuki Kozakai