python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

IPv6 disabled

Open GoogleCodeExporter opened this issue 10 years ago • 14 comments
trafficstars

What device(s) are you experiencing the problem on?
HTC Desire HD

What firmware version are you running on the device?
Android 2.2

What steps will reproduce the problem?
1. Create the following Python script:
import socket
print socket.has_ipv6
s = socket.socket(socket.AF_INET6, socket. SOCK_DGRAM)
s.bind(("::1", 9000))
s.recv(1024)

What is the expected output?
True
[Wait for incoming connection]

What do you see instead?
False
Exception: socket.error: getsockaddrarg: bad family

What version of the product are you using? On what operating system?
SL4A r3 + Python 2.6.2

Please provide any additional information below.
Python seems to be compiled without --enable-ipv6. Please enable it in the 
build.

Thanks

Original issue reported on code.google.com by [email protected] on 20 Mar 2011 at 4:09

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

I've had a serious look at this, but it looks like the Android NDK doesn't 
provide ipv6 support. Or at any rate, not in a form Python can cope with.

When I enable ipv6, I get the following error:

/home/robbie/python-for-android/python-build/python/jni/../../python-src/Modules
/getaddrinfo.c:433: error: 'struct in6_addr' has no member named 's6_addr8'

I'm open to suggestions, though.

Original comment by rjmatthews62 on 21 Mar 2011 at 3:00

  • Changed state: Accepted

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

[deleted comment]

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

See upstream cpython issue http://bugs.python.org/issue15538

Original comment by [email protected] on 2 Aug 2012 at 3:28

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

The Patch [PATCH] python: enabled IPv6 socket support from 
http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/40455 will solve the 
premature exit of the 'configure.sh' script when cross-compiling for android. 
The 'configure.sh' script echo before exit the message:
""" 'Fatal: You must get working getaddrinfo() function.'
'or you can specify "--disable-ipv6"'. """

After compilation the above step that will reproduce the problem return 'true'

Original comment by [email protected] on 11 Aug 2012 at 1:44

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

Does "s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)" succeed ?

Original comment by [email protected] on 11 Aug 2012 at 8:17

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

Forget me last comment, got it working now.

Original comment by [email protected] on 11 Aug 2012 at 8:26

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

How is it working?

I have the same issue.

Original comment by [email protected] on 10 Jun 2013 at 12:45

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

You need to rebuild Python with ipv6 enabled, see patch for Python 2.7: 
http://code.google.com/p/android-python27/source/browse/python-build/patch/Pytho
n-2.7.2-enable_ipv6.patch

Original comment by [email protected] on 10 Jun 2013 at 12:49

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

Ok thanks. Is there no APK Package yet?
If you have python could you provide it somewhere?

Original comment by [email protected] on 10 Jun 2013 at 12:52

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

You can build your own APK following instructions there: 
http://code.google.com/p/android-python27/ (Python 2.7 with ipv6 would be 
embeded)

Original comment by [email protected] on 10 Jun 2013 at 12:55

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

Ah ok these are ust zip packages.
Is it statically linked?
So you could just provide the binary.

Original comment by [email protected] on 10 Jun 2013 at 12:55

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

Ooops, i edited that last comment.
I asked whether there is no python with ipv6 readily availabe?

Original comment by [email protected] on 10 Jun 2013 at 12:56

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

ok thx for the info for the instructions

Original comment by [email protected] on 10 Jun 2013 at 12:56

GoogleCodeExporter avatar Mar 14 '15 22:03 GoogleCodeExporter

What if in pyconfig.h you change #undef ENABLE_IPV6 to #define ENABLE_IPV6 1 ?

devpack avatar Jun 17 '16 08:06 devpack