Bug 200060 - lang/python[*]: Missing network-related constants
Summary: lang/python[*]: Missing network-related constants
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2015-05-09 03:27 UTC by Yuri Victorovich
Modified: 2021-12-14 01:43 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback+
koobs: maintainer-feedback? (yuri)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2015-05-09 03:27:47 UTC
Both python 2 and 3 are missing some setsockopt values, for example in the code below:
They all come from /usr/include/netinet/in.h, but IP_MULTICAST_LOOP=11 is still in python, but IP_ADD_MEMBERSHIP=12 isn't.

Additionally, IPPROTO_DIVERT is also missing, so I have to use:
> socket_IPPROTO_DIVERT=258



Example:
> import socket
> sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
> sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_VIF, 1)
> sock.setsockopt(socket.IPPROTO_IP, socket.IP_RSVP_ON, 1)
> sock.setsockopt(socket.IPPROTO_IP, socket.IP_PORTRANGE, 1)
> sock.setsockopt(socket.IPPROTO_IP, socket.IP_RECVIF, 1)
Comment 1 Walter Schwarzenfeld 2018-01-09 00:30:53 UTC
 /usr/include/netinet/in.h has
#define IP_MULTICAST_LOOP       11
#define IP_ADD_MEMBERSHIP       12 

IPPROTO_DIVERT is not in.

but is this still relevant?
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2018-01-09 01:51:09 UTC
(In reply to w.schwarzenfeld from comment #1)

Yes, this can never become irrelevant. All network values from /usr/include/netinet/in.h need to be reflected in python (all versions).

The only reason this hasn't come up much is that there is not not much software that does low-level network operations. Or, porters might just patch in ad-hoc values because it is much easier.

But in the ideal world they should all be defined in python.

(#define IPPROTO_DIVERT          258 is also there)
Comment 3 Rene Ladan freebsd_committer freebsd_triage 2018-12-18 09:36:27 UTC
Closing this PR, since it specifically only mentions lang/python34 which expired today.
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2018-12-18 09:38:05 UTC
Valid for all versions of python.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2021-12-07 00:19:47 UTC
Is this still a thing in recent versions?
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2021-12-09 23:05:39 UTC
Python-3.9 now has socket.IP_ADD_MEMBERSHIP, but socket.IPPROTO_DIVERT is still missing, and socket.IPPROTO_CARP is also missing. Probably other constants are also missing.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2021-12-09 23:16:48 UTC
(In reply to Yuri Victorovich from comment #6)

To clarify, this is an 'upstream doesn't support certain socket options on freebsd' issue, and applies to all versions, modulo adding IP_ADD_MEMBERSHIP for 3.9+?

1) Is comment 0 a complete list of missing socket options?

2) Is there a difference in socket options between FreeBSD versions that needs to be considered?

3) Are there any additional changes/additions in 3.10+ ?

Answers to those question is a good first to pushing this upstream