Skip to contentSkip to conversation

ebtables broken for kernel above 2.6.28

DISCUSSION sachin sanap 5 participants 12 messages May 29, 2009 – Jun 19, 2009 2 messages not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Thanks
-Sachin

---------- Forwarded message ----------
From: Bart De Schuymer <[email protected]>
Date: Thu, May 28, 2009 at 9:40 PM
Subject: Re: ebtables broken for kernel above 2.6.28
To: sachin sanap <[email protected]>
Cc: [email protected], [email protected]

You can ask around on [email protected] to see if it has been fixed.

Regards,
Bart

sachin sanap schreef:

Quoted 12 lines

Hi ,
It seems there is some structure alignment problem with the kernel , since the ebtables binary works correctly with 2.6.27 kernel.Iam digging into the problem. This mail is just to confirm that its not already fixed.

Thanks
-Sachin

#3 lore raw
Quoted 6 lines · sachin sanap

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Indeed this seems to happen, but only when using a mixed-bitness combination:

/tmp/usr/sbin # LD_LIBRARY_PATH=../lib ./ebtables -A INPUT -j ACCEPT The kernel doesn't support the ebtables 'filter' table.

/tmp/usr/sbin # uname -a
Linux sovereign 2.6.29.3-jen80-default #1 SMP 2009-04-06 18:10:58 +0200 x86_64 x86_64 x86_64 GNU/Linux

/tmp/usr/sbin # file ebtables
ebtables: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped

ebtables does work when it is 64-bit too, so the immediate workaround — assuming you are on x86 — is to not use a 32-bit userspace with a 64-bit kernel.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Sorry dint inform you earlier that iam on 32bit ARM machine. The real problem is the kernel is computing the alignment on __alignof__(struct _xt_align) and the userspace ebtables is computing it on __alignof__(struct ebt_entry_target) , which are two different structs.

I have the following patch for ebtables-v2.0.8-2 that fixes this.

--- ebtables-v2.0.8-2.orig/include/ebtables_u.h 2009-05-29 21:41:32.000000000 +0530
+++ ebtables-v2.0.8-2/include/ebtables_u.h 2009-05-29
21:43:32.000000000 +0530
@@ -25,6 +25,7 @@
#define EBTABLES_U_H
#include <netinet/in.h>
#include <linux/netfilter_bridge/ebtables.h>
+#include <linux/netfilter/x_tables.h>

#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
@@ -37,7 +38,7 @@
#define EXEC_STYLE_DAEMON 1

#ifndef EBT_MIN_ALIGN
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target)) +#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))
#endif
#define EBT_ALIGN(s) (((s) + (EBT_MIN_ALIGN-1)) & ~(EBT_MIN_ALIGN-1)) #define ERRORMSG_MAXLEN 128

-Sachin

Quoted 20 lines · Jan Engelhardt
Quoted 6 lines · sachin sanap

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Indeed this seems to happen, but only when using a mixed-bitness combination:

/tmp/usr/sbin # LD_LIBRARY_PATH=../lib ./ebtables -A INPUT -j ACCEPT The kernel doesn't support the ebtables 'filter' table.

/tmp/usr/sbin # uname -a
Linux sovereign 2.6.29.3-jen80-default #1 SMP 2009-04-06 18:10:58 +0200 x86_64 x86_64 x86_64 GNU/Linux

Quoted 8 lines

/tmp/usr/sbin # file ebtables
ebtables: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped

ebtables does work when it is 64-bit too, so the immediate workaround — assuming you are on x86 — is to not use a 32-bit userspace with a 64-bit kernel.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Hi,

I think it's best to fix this in the kernel if it's possible, since we don't want to break compatibility. If the fix has to be in userspace, then it must be a fix that still works for older kernels.

cheers,
Bart

sachin sanap schreef:

Quoted 69 lines

Sorry dint inform you earlier that iam on 32bit ARM machine. The real problem is the kernel is computing the alignment on __alignof__(struct _xt_align) and the userspace ebtables is computing it on __alignof__(struct ebt_entry_target) , which are two different structs.

I have the following patch for ebtables-v2.0.8-2 that fixes this.

--- ebtables-v2.0.8-2.orig/include/ebtables_u.h 2009-05-29 21:41:32.000000000 +0530
+++ ebtables-v2.0.8-2/include/ebtables_u.h 2009-05-29
21:43:32.000000000 +0530

(quoted diff) +2 -2
@@ -25,6 +25,7 @@
 #define EBTABLES_U_H
 #include <netinet/in.h>
 #include <linux/netfilter_bridge/ebtables.h>
+#include <linux/netfilter/x_tables.h>
 
 #ifndef IPPROTO_SCTP
 #define IPPROTO_SCTP           132
@@ -37,7 +38,7 @@
 #define EXEC_STYLE_DAEMON      1
 
 #ifndef EBT_MIN_ALIGN
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))
 #endif
 #define EBT_ALIGN(s) (((s) + (EBT_MIN_ALIGN-1)) & ~(EBT_MIN_ALIGN-1))
 #define ERRORMSG_MAXLEN 128
 
 
-Sachin
Quoted 20 lines · Jan Engelhardt
Quoted 7 lines · sachin sanap

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Indeed this seems to happen, but only when using a mixed-bitness combination:

/tmp/usr/sbin # LD_LIBRARY_PATH=../lib ./ebtables -A INPUT -j ACCEPT The kernel doesn't support the ebtables 'filter' table.

/tmp/usr/sbin # uname -a
Linux sovereign 2.6.29.3-jen80-default #1 SMP 2009-04-06 18:10:58 +0200 x86_64 x86_64 x86_64 GNU/Linux

Quoted 9 lines

/tmp/usr/sbin # file ebtables
ebtables: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped

ebtables does work when it is 64-bit too, so the immediate workaround — assuming you are on x86 — is to not use a 32-bit userspace with a 64-bit kernel.

Quoted 7 lines

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 6 lines · Bart De Schuymer

Hi,

I think it's best to fix this in the kernel if it's possible, since we don't want to break compatibility.
If the fix has to be in userspace, then it must be a fix that still works for older kernels.

Since the kernel uses xt_align already, it's best for userspace to do the same.

Quoted 13 lines
Quoted 13 lines

#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132

(quoted diff) +1 -1
@@ -37,7 +38,7 @@
 #define EXEC_STYLE_DAEMON      1
 
 #ifndef EBT_MIN_ALIGN
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))
 #endif
 #define EBT_ALIGN(s) (((s) + (EBT_MIN_ALIGN-1)) & ~(EBT_MIN_ALIGN-1))
 #define ERRORMSG_MAXLEN 128
#7 lore raw
Quoted 8 lines · Jan Engelhardt
Quoted 4 lines · Bart De Schuymer

I think it's best to fix this in the kernel if it's possible, since we don't want to break compatibility.
If the fix has to be in userspace, then it must be a fix that still works for older kernels.

Since the kernel uses xt_align already, it's best for userspace to do the same.

But that doesn't work for older kernels. Please don't dismiss compatibility issues that easily. Sometimes things unfortunately do slip through, but I expect people to do their best to fix the problem properly when this happens.

#8 lore raw
Quoted 14 lines · Patrick McHardy
Quoted 7 lines · Jan Engelhardt
Quoted 6 lines · Bart De Schuymer

I think it's best to fix this in the kernel if it's possible, since we don't want to break compatibility. If the fix has to be in userspace, then it must be a fix that still works for older kernels.

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))

Since the kernel uses xt_align already, it's best for userspace to do the same.

Quoted 4 lines

But that doesn't work for older kernels. Please don't dismiss compatibility issues that easily. Sometimes things unfortunately do slip through, but I expect people to do their best to fix the problem properly when this happens.

But if it gets changed back again to ebt_entry_target, it might stop working for the combinations it currently works on. :/

#9 lore raw
Quoted 17 lines · Jan Engelhardt
Quoted 15 lines · Patrick McHardy
Quoted 13 lines · Jan Engelhardt

Review

Quoted 8 lines · Bart De Schuymer

I think it's best to fix this in the kernel if it's possible, since we don't want to break compatibility. If the fix has to be in userspace, then it must be a fix that still works for older kernels.

(quoted diff) +1 -1
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))

Since the kernel uses xt_align already, it's best for userspace to do the same.

Quoted 9 lines
Quoted 5 lines

But that doesn't work for older kernels. Please don't dismiss compatibility issues that easily. Sometimes things unfortunately do slip through, but I expect people to do their best to fix the problem properly when this happens.

But if it gets changed back again to ebt_entry_target, it might stop working for the combinations it currently works on. :/

Why, ebtables userspace didn't change, which implies it will still work?

#10 lore raw
In reply to sachin sanap
Quoted 8 lines · sachin sanap

Sorry dint inform you earlier that iam on 32bit ARM machine. The real problem is the kernel is computing the alignment on __alignof__(struct _xt_align) and the userspace ebtables is computing it on __alignof__(struct ebt_entry_target) , which are two different structs.

I have the following patch for ebtables-v2.0.8-2 that fixes this.

Review line 44

Quoted 8 lines
(quoted diff) +1 -1
@@ -37,7 +38,7 @@
 #define EXEC_STYLE_DAEMON      1
 
 #ifndef EBT_MIN_ALIGN
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))
 #endif
 #define EBT_ALIGN(s) (((s) + (EBT_MIN_ALIGN-1)) & ~(EBT_MIN_ALIGN-1))
 #define ERRORMSG_MAXLEN 128

Can you run this, just to give me a better understanding of ARM32?

#include <stdio.h>
#include <stdint.h>

#define p(t) \
	printf(#t ": %zu\n", __alignof__(t));

int main(void)

{
	p(uint8_t);
	p(uint16_t);
	p(uint32_t);
	p(uint64_t);
	p(float);
	p(double);
	p(void *);
	p(void (*)(void));
}
#11 lore raw
Quoted 28 lines · Jan Engelhardt
Quoted 8 lines · sachin sanap

Sorry dint inform you earlier that iam on 32bit ARM machine. The real problem is the kernel is computing the alignment on __alignof__(struct _xt_align) and the userspace ebtables is computing it on __alignof__(struct ebt_entry_target) , which are two different structs.

I have the following patch for ebtables-v2.0.8-2 that fixes this.

Review line 44

Quoted 8 lines
(quoted diff) +1 -1
@@ -37,7 +38,7 @@
 #define EXEC_STYLE_DAEMON      1
 
 #ifndef EBT_MIN_ALIGN
-#define EBT_MIN_ALIGN (__alignof__(struct ebt_entry_target))
+#define EBT_MIN_ALIGN (__alignof__(struct _xt_align))
 #endif
 #define EBT_ALIGN(s) (((s) + (EBT_MIN_ALIGN-1)) & ~(EBT_MIN_ALIGN-1))
 #define ERRORMSG_MAXLEN 128

Can you run this, just to give me a better understanding of ARM32?

#include <stdio.h>
#include <stdint.h>

#define p(t) \
       printf(#t ": %zu\n", __alignof__(t));

int main(void)

Quoted 11 lines
{
       p(uint8_t);
       p(uint16_t);
       p(uint32_t);
       p(uint64_t);
       p(float);
       p(double);
       p(void *);
       p(void (*)(void));
}

Here is the output from ARM

uint8_t: 1
uint16_t: 2
uint32_t: 4
uint64_t: 8
float: 4
double: 8
void *: 4
void (*)(void): 4

I have CONFIG_AEABI=y

-Sachin Sanap

#12 lore raw
In reply to sachin sanap

Could anybody suggest correct fix for this problem? After reading full thread I'm unsure what to do... BTW, where ebtables (userspace) development now flows? Does it still uses the sourceforge's CVS server?

Thanks,
--
Peter.

В Птн, 29/05/2009 в 11:21 +0530, sachin sanap пишет:

Quoted 23 lines

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Thanks
-Sachin

---------- Forwarded message ----------
From: Bart De Schuymer <[email protected]>
Date: Thu, May 28, 2009 at 9:40 PM
Subject: Re: ebtables broken for kernel above 2.6.28
To: sachin sanap <[email protected]>
Cc: [email protected], [email protected]

You can ask around on [email protected] to see if it has been fixed.

Regards,
Bart

Signature · 6 lines
Peter.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#13 lore raw

The sourceforge page is still the site to obtain the userspace tool. Some unreleased code is in the cvs. Kernel changes seem to get in these days without checking for compatibility with userspace. Please fix things up in the kernel code. I sure hope that's possible. I won't accept a patch to the userspace code that makes the application no longer work on older kernels.

cheers,
Bart

Peter Volkov schreef:

Quoted 4 lines

Could anybody suggest correct fix for this problem? After reading full thread I'm unsure what to do... BTW, where ebtables (userspace) development now flows? Does it still uses the sourceforge's CVS server?

Quoted 32 lines

Thanks,
--
Peter.

В Птн, 29/05/2009 в 11:21 +0530, sachin sanap пишет:

Quoted 24 lines

Iam facing problem with ebtables binay on 2.6.28 kernel (same binary works well with 2.6.27). Its mostly a structure alignment issue with standard targets like DROP,ACCEPT etc. Message seen by user is "eb_tables: standard target: invalid size 8 != 4"
Iam trying to fix it, this mail is just to check if its already fixed by someone else?

Thanks
-Sachin

---------- Forwarded message ----------
From: Bart De Schuymer <[email protected]>
Date: Thu, May 28, 2009 at 9:40 PM
Subject: Re: ebtables broken for kernel above 2.6.28
To: sachin sanap <[email protected]>
Cc: [email protected], [email protected]

You can ask around on [email protected] to see if it has been fixed.

Regards,
Bart

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html