packages
packages copied to clipboard
python3: socket.setsockopt() returns 'OSError: [Errno 22] Invalid argument'
Maintainer: @jefferyto Environment:
opkg info python3
Package: python3
Version: 3.10.13-2
/etc/board.json
{"id": "elecom,wrc-1167gst2", "name": "ELECOM WRC-1167GST2"}
/etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='22.03.6'
DISTRIB_REVISION='r20265-f85a79bcb4'
DISTRIB_TARGET='ramips/mt7621'
DISTRIB_ARCH='mipsel_24kc'
DISTRIB_DESCRIPTION='OpenWrt 22.03.6 r20265-f85a79bcb4'
DISTRIB_TAINTS=''
Description: I'm not sure it is Python3 package bug or Kernel limitation. macOS ARM64 Python3.9.6, RHEL8 x86_64 Python 3.9.16 has no problem with below code. But, It fails under my router.
Python 3.10.13 (main, Dec 3 2023, 19:02:26) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM, SOL_SOCKET, SO_RCVTIMEO
>>> import struct
>>> socket = socket(AF_INET, SOCK_STREAM)
>>> rcvtout = struct.pack('ll', 2, 456789)
>>> socket.setsockopt(SOL_SOCKET, SO_RCVTIMEO, rcvtout)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>>>
I have the same problem in M2Crypto, and I am really not sure what's going on. Tried everything possible in https://gitlab.com/m2crypto/m2crypto/-/commits/32bit and nothing seems to work. I’ll investigate it further.