Skip to contentSkip to conversation

Iptables 1.3.7 and uClibc

DISCUSSION [email protected] 2 participants 3 messages Feb 21, 2007 – Feb 23, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to build iptables 1.3.7 with uClibc 0,9,27 for cris architecture. I'm having some problems while loading shared ipt libraries (when invoking iptables). Build string:

CC="gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM -D_REENTRANT -mno-mul-bug-workaround -muclibc=/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc" \
CROSS="cris-axis-linux-gnu-" \
CFLAGS="-O2 -pipe -Wall" \
LDFLAGS="-L/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -Wl,-rpath-link,/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib" \
STATIC="" \
KERNEL_DIR=\"/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/linux-R2/build/uclibc/\" \
LIBDIR="/lib" \
make \
all

I've managed to build iptables with my cross-compile toolchain. On target system I can run the iptables binary:

# iptables --version
iptables v1.3.7
# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

When trying to set som rules I get following error:

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables v1.3.7: Couldn't load target '/lib/iptables/libipt_MASQUERADE.so'

Try `iptables -h' or 'iptables --help' for more information.

I've hacked the iptables.c source to get full path displayed when error occurs. I can verify that the file /lib/iptables/libipt_MASQUERADE.so actually exists on the target rootfs.

What am I missing here?!

PS.: I've tried to statically compile iptables but with no avail - iptables failed with:

# iptables
getsockopt failed strangely: No such file or directory

best regards,
hinko

Signature · 7 lines
ÄŒETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: [email protected]
Http: www.cetrtapot.si
#1 lore raw

I'd recommend uncommenting the

NO_SHARED_LIBS = 1

at the top of the Makefile. That way they will all be built into one binary and you won't have to worry about the executable finding things.

Quoted 57 lines · On Wednesday 21 February 2007 07:54, [email protected] wrote:

Hello,

I'm trying to build iptables 1.3.7 with uClibc 0,9,27 for cris architecture. I'm having some problems while loading shared ipt libraries (when invoking iptables). Build string:

CC="gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM -D_REENTRANT

(quoted diff) +0 -2
-mno-mul-bug-workaround
-muclibc=/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc" \

CROSS="cris-axis-linux-gnu-" \
CFLAGS="-O2 -pipe -Wall" \
LDFLAGS="-L/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -Wl,-rpath-link,/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib" \
STATIC="" \
KERNEL_DIR=\"/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/linux-R2/build/ucl ibc/\" \
LIBDIR="/lib" \
make \
all

I've managed to build iptables with my cross-compile toolchain. On target system I can run the iptables binary:

# iptables --version
iptables v1.3.7
# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

When trying to set som rules I get following error:

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables v1.3.7: Couldn't load target '/lib/iptables/libipt_MASQUERADE.so'

Try `iptables -h' or 'iptables --help' for more information.

I've hacked the iptables.c source to get full path displayed when error occurs. I can verify that the file /lib/iptables/libipt_MASQUERADE.so actually exists on the target rootfs.

What am I missing here?!

PS.: I've tried to statically compile iptables but with no avail - iptables failed with:

# iptables
getsockopt failed strangely: No such file or directory

best regards,
hinko

Signature · 3 lines
Alan Ezust            www.presinet.com
Presinet, inc         [email protected]
           Victoria, BC, Canada
#2 lore raw
Quoted 6 lines · Alan Ezust

I'd recommend uncommenting the

NO_SHARED_LIBS = 1

at the top of the Makefile. That way they will all be built into one binary and you won't have to worry about the executable finding things.

I've tried that, but when I tried to execute the iptables binary on the target system, it failed with:

getsockopt failed strangely: No such file or directory

Maybe I'll look in to it, but in the meanwhile I managed to get iptables version 1.2.7 to work. I still don't know why 1.3.7 can't load the shared object it needs, while it works on 1.2.7. Maybe my kernel version - 2.6.12 is too old?

Best regards,
hinko

Signature · 7 lines
ÄŒETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: [email protected]
Http: www.cetrtapot.si