Skip to contentSkip to conversation

New: python-iptables runtime dependencies

Buildroot bugzilla at busybox.net 1 participant 5 messages Oct 21, 2019 – Jan 6, 2022

lore
Share & tools
lore
#0 lore raw

https://bugs.busybox.net/show_bug.cgi?id=12271

Bug ID: 12271
Summary: python-iptables runtime dependencies
Product: buildroot
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at buildroot.uclibc.org
Reporter: matthew.weber at rockwellcollins.com
CC: buildroot at uclibc.org
Target Milestone: ---

When integrating the python iptables wrapper I found two missing pieces.

The first piece is the naming of the c library so that iptc/xtables can find it. I've just pasted my post_build fixup here but it probably would find a home in the toolchain package.
pushd ${DEST_DIR}/lib
ln -sf libc.so.6 libc.so
popd

The second item is for the xtables c wrapper to find the library, a /etc/profile.d/python-iptc.sh or similar needs added with the following.

#!/bin/sh
export PYTHON_IPTABLES_XTABLES_VERSION=12
export XTABLES_LIBDIR=/usr/lib/python2.7/site-packages/:/usr/lib/xtables # The interactive console doesn't require the following, however

# direct scripting use does
export IPTABLES_LIBDIR=/lib:/usr/lib

Here's a basic build were these changes can be observed.

BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_IPTABLES=y
BR2_TARGET_ROOTFS_EXT2=y
# BR2_TARGET_ROOTFS_TAR is not set

Here's the output before setting up the lib link.

Welcome to Buildroot
buildroot login: root

# python
Python 2.7.17 (default, Oct 21 2019, 13:54:55) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

import iptc

random: fast init done
random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 796, in <module>
AttributeError: 'NoneType' object has no attribute '_handle'

Here's the output after setting up the lib link

# cd /lib
# ln -sf libc.so.6 libc.so
# python
Python 2.7.17 (default, Oct 21 2019, 13:54:55) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

import iptc

random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 812, in <module> File "usr/lib/python2.7/subprocess.py", line 394, in __init__ File "usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
OSError: [Errno 2] No such file or directory

Here's the output after setting up the profile env script.

# vi /etc/profile.d/python-iptc.sh  # paste in the above script then 
# python 
Python 2.7.17 (default, Oct 21 2019, 13:54:55) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

import iptc

random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read)
random: python: uninitialized urandom read (2500 bytes read) Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "usr/lib/python2.7/site-packages/iptc/__init__.py", line 10, in <module> File "usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 13, in <module> File "usr/lib/python2.7/site-packages/iptc/xtables.py", line 812, in <module> File "usr/lib/python2.7/subprocess.py", line 394, in __init__ File "usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
OSError: [Errno 2] No such file or directory

Quoted 1 line
Quoted 1 line
Quoted 1 line

^^^^^^^^^^^^^^^ above failed since we didn't restart the shell, so exit

# exit

Welcome to Buildroot
buildroot login: root

# python
Python 2.7.17 (default, Oct 21 2019, 13:54:55) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

import iptc

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.
#1 lore raw

[Buildroot] [Bug 12271] python-iptables runtime dependencies

https://bugs.busybox.net/show_bug.cgi?id=12271

Frank Vanbever <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at buildroot.uclibc |frank.vanbever+brbugzilla at e
|.org |ssensium.com

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.
#3 lore raw

[Buildroot] [Bug 12271] python-iptables runtime dependencies

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=12271

Thomas Petazzoni <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Thomas Petazzoni <[email protected]> --- This has been fixed by:

https://git.buildroot.org/buildroot/commit/?id=21b85bc56cdcf030cced57dea0f78cdce59912b8
https://git.buildroot.org/buildroot/commit/?id=90c18ab269c600ee7643f69212713ee3b74c38bd
https://git.buildroot.org/buildroot/commit/?id=52276cdda34aa986410626592031560bf64d788b

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.
#4 lore raw

[Buildroot] [Bug 12271] python-iptables runtime dependencies

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=12271

--- Comment #2 from Arnout Vandecappelle <[email protected]> --- It was actually only fixed by
https://git.buildroot.org/buildroot/commit/?id=d341ec035067120b456f669a826e26eb594c0237

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot