On Tue, Feb 07, 2012 at 02:15:28PM +0100, Phil Sutter wrote:
> Luca,
>
> On Tue, Feb 07, 2012 at 01:53:33PM +0100, Luca Deri wrote:
> > said that the problem is clear, I am wondering what is the conceptual
> > reason why you want to mix environments. Wouldn't you better recompile the
> > system using the correct platform version?
>
> Our pf_ring user is a 32bit-only binary, so using a 64bit
> userspace is not possible for us. Please note that the kernel has
> compatibility interfaces for these situations, which generally do work
> just fine. Most distributions (e.g. Debian or Gentoo) use this setup on
> UltraSPARC because of lower overhead, so this combination is not totally
> unusual.
I was asked about our eventual solution for this problem today and
thought since I now have a cleaned version of our workaround, I post it
here for reference.
Please note that this is a solution fixing the 32bit userland/64bit
kernel situation and not affecting 32bit userland/32bit kernel BUT
breaking 64bit userland/64bit kernel since the patch simply makes the
code assume a 32bit userland at all times.
Though not optimal, in my point of view it is the best solution not
requiring a more or less substantial rewrite.
Best wishes,
Phil Sutter
Software Engineer
--
Viprinet - Never be offline again!
************************************************
Viprinet auf der CeBIT 2013 - 5.-9. März:
Besuchen Sie uns in Halle 13, Stand D27!
Alle gezeigten Produkte im Livebetrieb,
zahlreiche Beispielapplikationen. Gerne
schicken wir Ihnen kostenlose Eintrittskarten.
http://www.viprinet.com/de/cebit-2013
************************************************
Viprinet at CeBIT 2013, March 5 to 9
in Hannover, Germany. Come and visit us
at Hall 13, Booth D27! All exhibits shown
live, many sample applications. We’ll be
happy to send you free admission tickets.
http://www.viprinet.com/en/cebit-2013
************************************************
Viprinet Europe GmbH
Mainzer Str. 43
55411 Bingen am Rhein
Germany
Phone/Zentrale: +49 6721 49030-0
Direct line/Durchwahl: +49 6721 49030-134
Fax: +49 6721 49030-109
[email protected]
http://www.viprinet.com
Registered office/Sitz der Gesellschaft: Bingen am Rhein, Germany
Commercial register/Handelsregister: Amtsgericht Mainz HRB44090
CEO/Geschäftsführer: Simon Kissel
diff -Naurp PF_RING-5.2.1.orig/kernel/linux/pf_ring.h PF_RING-5.2.1/kernel/linux/pf_ring.h
--- PF_RING-5.2.1.orig/kernel/linux/pf_ring.h 2011-11-27 15:03:54.000000000 +0100
+++ PF_RING-5.2.1/kernel/linux/pf_ring.h 2013-02-25 10:09:25.800565328 +0100
@@ -15,6 +15,10 @@
#include <netinet/in.h>
#endif /* __KERNEL__ */
+#ifdef CONFIG_COMPAT
+# include <linux/compat.h>
+#endif /* CONFIG_COMPAT */
+
#define INCLUDE_MAC_INFO
#ifdef INCLUDE_MAC_INFO
@@ -199,7 +203,11 @@ struct pfring_extended_pkthdr {
struct pfring_pkthdr {
/* pcap header */
+#ifdef CONFIG_COMPAT
+ struct compat_timeval ts; /* 32-bit sane struct timeval */
+#else
struct timeval ts; /* time stamp */
+#endif
u_int32_t caplen; /* length of portion present */
u_int32_t len; /* length this packet (off wire) */
struct pfring_extended_pkthdr extended_hdr; /* PF_RING extended header */
diff -Naurp PF_RING-5.2.1.orig/kernel/pf_ring.c PF_RING-5.2.1/kernel/pf_ring.c
--- PF_RING-5.2.1.orig/kernel/pf_ring.c 2011-12-13 18:40:16.000000000 +0100
+++ PF_RING-5.2.1/kernel/pf_ring.c 2013-02-25 10:19:04.856583388 +0100
@@ -2056,6 +2056,7 @@ success:
/* ********************************** */
static inline void set_skb_time(struct sk_buff *skb, struct pfring_pkthdr *hdr) {
+ struct timeval ts;
/* BD - API changed for time keeping */
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
if(skb->stamp.tv_sec == 0)
@@ -2071,7 +2072,9 @@ static inline void set_skb_time(struct s
if(skb->tstamp.tv64 == 0)
__net_timestamp(skb); /* If timestamp is missing add it */
- hdr->ts = ktime_to_timeval(skb->tstamp);
+ ts = ktime_to_timeval(skb->tstamp);
+ hdr->ts.tv_sec = ts.tv_sec;
+ hdr->ts.tv_usec = ts.tv_usec;
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30))
{
_______________________________________________
Ntop-dev mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev