From: Byoungyoung Lee <override@postech.ac.kr>
To: netfilter@vger.kernel.org
Subject: structure padding mismatches
Date: Fri, 13 Nov 2009 20:57:00 +0900 [thread overview]
Message-ID: <ba3207a80911130357r401977dapf2cc5cddc6319eca@mail.gmail.com> (raw)
I'm trying to install iptables 1.4.5 on embedded ARM machine, which
runs Linux kernel 2.6.15.7,
but I have a problem that kernel module (netfilter) and iptables see
the structure in a different way.
----------------------------------------------------------------------
// in ip_tables.h
/* The argument to IPT_SO_GET_ENTRIES. */
struct ipt_get_entries
{
/* Which table: user fills this in. */
char name[IPT_TABLE_MAXNAMELEN];
/* User fills this in: total entry size. */
unsigned int size;
/* The entries. */
struct ipt_entry entrytable[0];
};
----------------------------------------------------------------------
For example, from the above codes, iptables thinks the size of the
structure as '40',
but netfilter thiks the size of it as '36'.
I tried to solve this problem by appending '__attributed ((packed))'
to the structure,
and I could force iptables to think the structure size as '36',
but it turned out that so many structures which have such size mismatches !
I also tried to give the same compiling option (definitely I'm using
the same compiler, arm-linux-gcc, to build),
but iptables still have a structure padding problem.
The below dumps are what I got when I compiled iptables. It complains
that there are structure padding problems.
-------------------------------------------------------------
arm-linux-gcc -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE=1
-D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -Wall
-Waggregate-return -Wmissing-declarations -Wmissing-prototypes
-Wredundant-decls -Wshadow -Wstrict-prototypes -Winline -pipe
-DXTABLES_LIBDIR=\"/home/takkyun/trunk/iptables-1.4.5/my_install/libexec/xtables\"
-DXTABLES_INTERNAL -I./include -I./include -I
/home/takkyun/CMEST/PATH/linux-2.6.15.7_2008-01-31/include -I
/home/takkyun/CMEST/PATH/linux-2.6.15.7_2008-01-31/include
-DIPTABLES_MULTI -DALL_INCLUSIVE -ggdb3 -O2 -Wpadded -Wpacked
-mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -ffreestanding -g -O2
-fno-omit-frame-pointer -fno-optimize-sibling-calls
-fno-omit-frame-pointer -mapcs -mno-sched-prolog -mapcs-32
-mno-thumb-interwork -march=armv5te -mtune=xscale -Wa,-mcpu=xscale
-malignment-traps -msoft-float -Uarm -Wdeclaration-after-statement
-MT iptables_multi-xshared.o -MD -MP -MF
.deps/iptables_multi-xshared.Tpo -c -o iptables_multi-xshared.o `test
-f 'xshared.c' || echo './'`xshared.c
In file included from ./include/xtables.h:17,
from xshared.c:2:
./include/linux/netfilter/x_tables.h:22: warning: padding struct to
align 'match'
./include/linux/netfilter/x_tables.h:47: warning: padding struct to
align 'target'
./include/linux/netfilter/x_tables.h:78: warning: padding struct size
to alignment boundary
./include/linux/netfilter/x_tables.h:94: warning: padding struct to align 'u16'
-------------------------------------------------------------
How could I make these two programs see the structure as the same?
--
Byoungyoung Lee
HPC Lab., Dept. of Computer Science & Engineering, POSTECH, Pohang
Korea 790-784
Tel: +82-54-279-2915, Mobile: +82-10-9260-6720
reply other threads:[~2009-11-13 11:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba3207a80911130357r401977dapf2cc5cddc6319eca@mail.gmail.com \
--to=override@postech.ac.kr \
--cc=netfilter@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).