diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2017-09-29 21:42:28 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2017-09-29 21:42:28 +0300 |
commit | 6f8109c48a29a97e063c687e9a6513f55f28b9f7 (patch) | |
tree | 91dd4aaa3d131662e18768e889f95a50effd3ba7 /debian/patches/dyson-socketmodule-ifindex.patch | |
parent | 377002e7300431b68f3548d9fd2c7f99cf883939 (diff) | |
download | python3.8-6f8109c48a29a97e063c687e9a6513f55f28b9f7.tar.gz |
python3.6 (3.6.3~rc1-2+dyson1)dyson/3.6.3_rc1-2+dyson1
Diffstat (limited to 'debian/patches/dyson-socketmodule-ifindex.patch')
-rw-r--r-- | debian/patches/dyson-socketmodule-ifindex.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/debian/patches/dyson-socketmodule-ifindex.patch b/debian/patches/dyson-socketmodule-ifindex.patch new file mode 100644 index 0000000..3e022d7 --- /dev/null +++ b/debian/patches/dyson-socketmodule-ifindex.patch @@ -0,0 +1,80 @@ +Index: python3.6-3.6.3~rc1/Modules/socketmodule.c +=================================================================== +--- python3.6-3.6.3~rc1.orig/Modules/socketmodule.c ++++ python3.6-3.6.3~rc1/Modules/socketmodule.c +@@ -284,6 +284,10 @@ http://cvsweb.netbsd.org/bsdweb.cgi/src/ + #include <sys/socket.h> + #endif + ++#ifdef HAVE_SYS_SOCKIO_H ++#include <sys/sockio.h> ++#endif ++ + #ifdef HAVE_NET_IF_H + #include <net/if.h> + #endif +@@ -1767,11 +1771,15 @@ getsockaddrarg(PySocketSockObject *s, Py + } + #endif + +-#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFINDEX) ++#if defined(HAVE_NETPACKET_PACKET_H) + case AF_PACKET: + { + struct sockaddr_ll* addr; ++#ifdef SIOCGLIFINDEX ++ struct lifreq lifr; ++#else + struct ifreq ifr; ++#endif + char *interfaceName; + int protoNumber; + int hatype = 0; +@@ -1790,6 +1798,15 @@ getsockaddrarg(PySocketSockObject *s, Py + &protoNumber, &pkttype, &hatype, + &haddr)) + return 0; ++#ifdef SIOCGLIFINDEX ++ strncpy(lifr.lifr_name, interfaceName, sizeof(lifr.lifr_name)); ++ lifr.lifr_name[(sizeof(lifr.lifr_name))-1] = '\0'; ++ if (ioctl(s->sock_fd, SIOCGLIFINDEX, &lifr) < 0) { ++ s->errorhandler(); ++ PyBuffer_Release(&haddr); ++ return 0; ++ } ++#else + strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)); + ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; + if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) { +@@ -1797,6 +1814,7 @@ getsockaddrarg(PySocketSockObject *s, Py + PyBuffer_Release(&haddr); + return 0; + } ++#endif + if (haddr.buf && haddr.len > 8) { + PyErr_SetString(PyExc_ValueError, + "Hardware address must be 8 bytes or less"); +@@ -1813,7 +1831,11 @@ getsockaddrarg(PySocketSockObject *s, Py + addr = (struct sockaddr_ll*)addr_ret; + addr->sll_family = AF_PACKET; + addr->sll_protocol = htons((short)protoNumber); ++#ifdef SIOCGLIFINDEX ++ addr->sll_ifindex = lifr.lifr_index; ++#else + addr->sll_ifindex = ifr.ifr_ifindex; ++#endif + addr->sll_pkttype = pkttype; + addr->sll_hatype = hatype; + if (haddr.buf) { +Index: python3.6-3.6.3~rc1/configure.ac +=================================================================== +--- python3.6-3.6.3~rc1.orig/configure.ac ++++ python3.6-3.6.3~rc1/configure.ac +@@ -2053,6 +2053,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/pol + sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ + sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ + sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ ++sys/sockio.h \ + sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ + sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ + libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ |