mirror of
https://github.com/termux/termux-packages.git
synced 2024-12-12 00:10:52 +00:00
e8b90f4597
* pypy: bump to 7.3.12 * pypy3: bump to 7.3.12 * @TERMUX_PKG_API_LEVEL@, fix patch filenames --------- Co-authored-by: Lucy Phipps <landfillbaby69@gmail.com>
57 lines
1.2 KiB
Diff
57 lines
1.2 KiB
Diff
`getprotobyname` is not implemented in Android's Bionic libc
|
|
|
|
--- a/rpython/rlib/rsocket.py
|
|
+++ b/rpython/rlib/rsocket.py
|
|
@@ -1627,11 +1627,48 @@
|
|
raise RSocketError("port/proto not found")
|
|
return rffi.charp2str(servent.c_s_name)
|
|
|
|
+PROTOCOL_NAME_AND_NUMBER = {
|
|
+ "ip": 0,
|
|
+ "icmp": 1,
|
|
+ "igmp": 2,
|
|
+ "ggp": 3,
|
|
+ "ipencap": 4,
|
|
+ "st": 5,
|
|
+ "tcp": 6,
|
|
+ "egp": 8,
|
|
+ "pup": 12,
|
|
+ "udp": 17,
|
|
+ "hmp": 20,
|
|
+ "xns-idp": 22,
|
|
+ "iso-tp4": 29,
|
|
+ "xtp": 36,
|
|
+ "ddp": 37,
|
|
+ "idpr-cmtp": 38,
|
|
+ "ipv6": 41,
|
|
+ "ipv6-route": 43,
|
|
+ "ipv6-frag": 44,
|
|
+ "idrp": 45,
|
|
+ "rsvp": 46,
|
|
+ "gre": 47,
|
|
+ "esp": 50,
|
|
+ "ah": 51,
|
|
+ "skip": 57,
|
|
+ "ipv6-icmp": 58,
|
|
+ "ipv6-nonxt": 59,
|
|
+ "ipv6-opts": 60,
|
|
+ "rspf": 73,
|
|
+ "vmtp": 81,
|
|
+ "ospf": 89,
|
|
+ "ipip": 94,
|
|
+ "encap": 98,
|
|
+ "pim": 103,
|
|
+ "raw": 255
|
|
+}
|
|
+
|
|
def getprotobyname(name):
|
|
- protoent = _c.getprotobyname(name)
|
|
- if not protoent:
|
|
+ proto = PROTOCOL_NAME_AND_NUMBER.get(name, -1)
|
|
+ if proto == -1:
|
|
raise RSocketError("protocol not found")
|
|
- proto = protoent.c_p_proto
|
|
return rffi.cast(lltype.Signed, proto)
|
|
|
|
def getnameinfo(address, flags):
|