* nfsim for Linux 2.6.12-rc4?
@ 2005-05-11 19:56 Max Kellermann
2005-05-11 20:06 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Max Kellermann @ 2005-05-11 19:56 UTC (permalink / raw)
To: netfilter-devel
Hi,
is anyone already working on the Linux 2.6.12 port of nfsim? If not,
I'll do it.
gcc -Wmissing-prototypes -Wstrict-prototypes -Wunused -Wall -g -Wa,-W
-I. -I/tmp/nfsim-3/core -I/tmp/nfsim-3/kernelenv/include
-I/tmp/nfsim-3/netfilter/include -c -DKBUILD_MODNAME=ip_nat_ftp -o
ip_nat_ftp.o ip_nat_ftp.c
ip_nat_ftp.c:174: warning: "struct kernel_param" declared inside
parameter list
ip_nat_ftp.c:174: warning: its scope is only this definition or
declaration, which is probably not what you want
ip_nat_ftp.c:180: error: parse error before '(' token
ip_nat_ftp.c:175: warning: 'warn_set' defined but not used
make[2]: *** [ip_nat_ftp.o] Error 1
Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nfsim for Linux 2.6.12-rc4?
2005-05-11 19:56 nfsim for Linux 2.6.12-rc4? Max Kellermann
@ 2005-05-11 20:06 ` Patrick McHardy
2005-05-11 20:29 ` Max Kellermann
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Patrick McHardy @ 2005-05-11 20:06 UTC (permalink / raw)
To: Max Kellermann; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
Max Kellermann wrote:
> is anyone already working on the Linux 2.6.12 port of nfsim? If not,
> I'll do it.
I have this patch, but I can't recall if it worked correctly with it or
not. It needs at least a couple #if KERNEL_VERSION > ... before it can
be committed.
Regards
Patrick
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 2766 bytes --]
Index: core/core.h
===================================================================
--- core/core.h (Revision 3887)
+++ core/core.h (Arbeitskopie)
@@ -196,7 +196,7 @@
const struct net_device *out,
const char *fmt, ...);
-int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
+int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **skb,
struct net_device *indev,
struct net_device *outdev,
int (*okfn)(struct sk_buff *)
@@ -207,8 +207,13 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
- nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn), INT_MIN)
+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
+({ int _ret; \
+ _ret = nf_hook_slow((pf), (hook), &(skb), (indev), (outdev), (okfn), INT_MIN); \
+ if (_ret == 1) \
+ _ret = (okfn)(skb); \
+ _ret; \
+})
#else
#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn))
Index: kernelenv/include/kernelenv.h
===================================================================
--- kernelenv/include/kernelenv.h (Revision 3887)
+++ kernelenv/include/kernelenv.h (Arbeitskopie)
@@ -183,6 +183,7 @@
#define cpu_possible(cpu) ((cpu) == 0)
#endif
#define smp_processor_id() 0
+#define num_possible_cpus() 1
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
@@ -244,6 +245,17 @@
extern unsigned long jiffies;
+static inline unsigned long msecs_to_jiffies(const unsigned int m)
+{
+#if HZ <= 1000 && !(1000 % HZ)
+ return (m + (1000 / HZ) - 1) / (1000 / HZ);
+#elif HZ > 1000 && !(HZ % 1000)
+ return m * (HZ / 1000);
+#else
+ return (m * HZ + 999) / 1000;
+#endif
+}
+
#define typecheck(type,x) \
({ type __dummy; \
typeof(x) __dummy2; \
@@ -929,8 +941,8 @@
};
-u32 dst_path_metric(struct dst_entry *dst, int metric);
-u32 dst_pmtu(struct dst_entry *dst);
+u32 dst_metric(struct dst_entry *dst, int metric);
+u32 dst_mtu(struct dst_entry *dst);
#define dst_release(x)
#define dst_hold(x)
Index: kernelenv/kernelenv.c
===================================================================
--- kernelenv/kernelenv.c (Revision 3887)
+++ kernelenv/kernelenv.c (Arbeitskopie)
@@ -583,16 +583,16 @@
#endif
}
-u32 dst_path_metric(struct dst_entry *dst, int metric)
+u32 dst_metric(struct dst_entry *dst, int metric)
{
return 1500;
/* return dst->path->metrics[metric-1]; */
}
-u32 dst_pmtu(struct dst_entry *dst)
+u32 dst_mtu(struct dst_entry *dst)
{
- u32 mtu = dst_path_metric(dst, RTAX_MTU);
+ u32 mtu = dst_metric(dst, RTAX_MTU);
/* Yes, _exactly_. This is paranoia. */
barrier();
return mtu;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nfsim for Linux 2.6.12-rc4?
2005-05-11 20:06 ` Patrick McHardy
@ 2005-05-11 20:29 ` Max Kellermann
2005-05-11 21:21 ` [PATCH nfsim] 2.6.12 compatibility Max Kellermann
2005-05-11 21:52 ` nfsim for Linux 2.6.12-rc4? Max Kellermann
2 siblings, 0 replies; 5+ messages in thread
From: Max Kellermann @ 2005-05-11 20:29 UTC (permalink / raw)
To: netfilter-devel
On 2005/05/11 22:06, Patrick McHardy <kaber@trash.net> wrote:
> I have this patch, but I can't recall if it worked correctly with it or
> not.
Unfortunately, it does not. Same compiler error as before.
Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH nfsim] 2.6.12 compatibility
2005-05-11 20:06 ` Patrick McHardy
2005-05-11 20:29 ` Max Kellermann
@ 2005-05-11 21:21 ` Max Kellermann
2005-05-11 21:52 ` nfsim for Linux 2.6.12-rc4? Max Kellermann
2 siblings, 0 replies; 5+ messages in thread
From: Max Kellermann @ 2005-05-11 21:21 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
On 2005/05/11 22:06, Patrick McHardy <kaber@trash.net> wrote:
> I have this patch, but I can't recall if it worked correctly with it or
> not. It needs at least a couple #if KERNEL_VERSION > ... before it can
> be committed.
The required changes in addition to your patch were trivial - there
were 3 definitions missing. A patch is attached. My patch does not
need #ifKERNEL_VERSIONs, I guess.
nfsim/2.6.12-rc4 seems to run well now - my h323-conntrack-nat test
suite succeeds.
Max
[-- Attachment #2: nfsim-2.6.12-defs.patch --]
[-- Type: text/plain, Size: 1031 bytes --]
Wed May 11 23:06:19 CEST 2005 max@duempel.org
* definitions for 2.6.12 compatibility
diff -rN -u old-nfsim-0/core/core.h new-nfsim-0/core/core.h
--- old-nfsim-0/core/core.h 2005-05-11 23:19:44.000000000 +0200
+++ new-nfsim-0/core/core.h 2005-05-11 23:05:37.000000000 +0200
@@ -76,7 +76,8 @@
#define NF_STOLEN 2
#define NF_QUEUE 3
#define NF_REPEAT 4
-#define NF_MAX_VERDICT NF_REPEAT
+#define NF_STOP 5
+#define NF_MAX_VERDICT NF_STOP
#define NF_MAX_HOOKS 8
diff -rN -u old-nfsim-0/kernelenv/include/kernelenv.h new-nfsim-0/kernelenv/include/kernelenv.h
--- old-nfsim-0/kernelenv/include/kernelenv.h 2005-05-11 23:19:45.000000000 +0200
+++ new-nfsim-0/kernelenv/include/kernelenv.h 2005-05-11 23:03:27.000000000 +0200
@@ -1130,6 +1130,9 @@
#define MODULE_PARM_DESC(x,n)
#define module_param(name, type, perm)
#define module_param_array(name, type, num, perm)
+#define module_param_call(name, set, get, arg, perm)
+
+struct kernel_param;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,28)
#define EXPORT_NO_SYMBOLS
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nfsim for Linux 2.6.12-rc4?
2005-05-11 20:06 ` Patrick McHardy
2005-05-11 20:29 ` Max Kellermann
2005-05-11 21:21 ` [PATCH nfsim] 2.6.12 compatibility Max Kellermann
@ 2005-05-11 21:52 ` Max Kellermann
2 siblings, 0 replies; 5+ messages in thread
From: Max Kellermann @ 2005-05-11 21:52 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
On 2005/05/11 22:06, Patrick McHardy <kaber@trash.net> wrote:
> I have this patch, but I can't recall if it worked correctly with it or
> not. It needs at least a couple #if KERNEL_VERSION > ... before it can
> be committed.
Now here is a patch which replaces yours, with the correct
#ifs. Tested on both 2.6.11 and 2.6.12. Note that the previous patch I
posted this evening (nfsim-2.6.12-defs.patch) is still required.
Max
[-- Attachment #2: nfsim-2.6.12-api.patch --]
[-- Type: text/plain, Size: 3531 bytes --]
Wed May 11 23:48:01 CEST 2005 max@duempel.org
* 2.6.11 corrections for patrick's patch
Wed May 11 22:41:47 CEST 2005 max@duempel.org
* Patrick's 2.6.12 patch
diff -rN -u old-nfsim-12/core/core.h new-nfsim-12/core/core.h
--- old-nfsim-12/core/core.h 2005-05-11 23:52:20.000000000 +0200
+++ new-nfsim-12/core/core.h 2005-05-11 23:51:19.000000000 +0200
@@ -196,7 +196,11 @@
const struct net_device *out,
const char *fmt, ...);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **skb,
+#else
int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
+#endif
struct net_device *indev,
struct net_device *outdev,
int (*okfn)(struct sk_buff *)
@@ -206,8 +210,16 @@
);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
+({ int _ret; \
+ _ret = nf_hook_slow((pf), (hook), &(skb), (indev), (outdev), (okfn), INT_MIN); \
+ if (_ret == 1) \
+ _ret = (okfn)(skb); \
+ _ret; \
+})
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn), INT_MIN)
#else
#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
diff -rN -u old-nfsim-12/kernelenv/include/kernelenv.h new-nfsim-12/kernelenv/include/kernelenv.h
--- old-nfsim-12/kernelenv/include/kernelenv.h 2005-05-11 23:52:20.000000000 +0200
+++ new-nfsim-12/kernelenv/include/kernelenv.h 2005-05-11 23:51:19.000000000 +0200
@@ -183,6 +183,7 @@
#define cpu_possible(cpu) ((cpu) == 0)
#endif
#define smp_processor_id() 0
+#define num_possible_cpus() 1
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
@@ -244,6 +245,17 @@
extern unsigned long jiffies;
+static inline unsigned long msecs_to_jiffies(const unsigned int m)
+{
+#if HZ <= 1000 && !(1000 % HZ)
+ return (m + (1000 / HZ) - 1) / (1000 / HZ);
+#elif HZ > 1000 && !(HZ % 1000)
+ return m * (HZ / 1000);
+#else
+ return (m * HZ + 999) / 1000;
+#endif
+}
+
#define typecheck(type,x) \
({ type __dummy; \
typeof(x) __dummy2; \
@@ -929,8 +941,13 @@
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+u32 dst_metric(struct dst_entry *dst, int metric);
+u32 dst_mtu(struct dst_entry *dst);
+#else
u32 dst_path_metric(struct dst_entry *dst, int metric);
u32 dst_pmtu(struct dst_entry *dst);
+#endif
#define dst_release(x)
#define dst_hold(x)
diff -rN -u old-nfsim-12/kernelenv/kernelenv.c new-nfsim-12/kernelenv/kernelenv.c
--- old-nfsim-12/kernelenv/kernelenv.c 2005-05-11 23:52:20.000000000 +0200
+++ new-nfsim-12/kernelenv/kernelenv.c 2005-05-11 23:51:19.000000000 +0200
@@ -583,16 +583,28 @@
#endif
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+u32 dst_metric(struct dst_entry *dst, int metric)
+#else
u32 dst_path_metric(struct dst_entry *dst, int metric)
+#endif
{
return 1500;
/* return dst->path->metrics[metric-1]; */
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+u32 dst_mtu(struct dst_entry *dst)
+#else
u32 dst_pmtu(struct dst_entry *dst)
+#endif
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ u32 mtu = dst_metric(dst, RTAX_MTU);
+#else
u32 mtu = dst_path_metric(dst, RTAX_MTU);
+#endif
/* Yes, _exactly_. This is paranoia. */
barrier();
return mtu;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-11 21:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 19:56 nfsim for Linux 2.6.12-rc4? Max Kellermann
2005-05-11 20:06 ` Patrick McHardy
2005-05-11 20:29 ` Max Kellermann
2005-05-11 21:21 ` [PATCH nfsim] 2.6.12 compatibility Max Kellermann
2005-05-11 21:52 ` nfsim for Linux 2.6.12-rc4? Max Kellermann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.