This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: socket module should expose AF_LINK
Type: enhancement Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: giampaolo.rodola, neologix, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2013-05-17 02:20 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
AF_LINK.patch giampaolo.rodola, 2013-05-21 01:14 review
Messages (6)
msg189420 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013-05-17 02:20
I bumped into this while exposing getifaddrs() [1] in psutil:
https://code.google.com/p/psutil/issues/detail?id=376

In that case AF_LINK would be useful to distinguish MAC addresses (see also: http://carnivore.it/2010/07/22/python_-_getifaddrs).

[1] http://man7.org/linux/man-pages/man3/getifaddrs.3.html
msg189572 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-05-19 08:20
Well, this just needs a patch :-)
msg189715 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013-05-21 00:27
Mmm I'm not sure how to do this properly.
Apparently it seems I can:

--- a/Lib/plat-freebsd8/regen
+++ b/Lib/plat-freebsd8/regen
@@ -1,3 +1,3 @@
 #! /bin/sh
 set -v
-python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h /usr/include/sys/socket.h

...and then rerun Tools/scripts/h2py.py in order to "#ifdef AF_LINK" from within socketmodule.c but what about other FreeBSD versions? Why there's no Lib/plat-freebsd9 directory?
msg189716 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013-05-21 01:14
Nevermind, it seems changing regen is not necessary. Patch is in attachment.
msg189757 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-05-21 14:09
> Nevermind, it seems changing regen is not necessary. Patch is in attachment.

Go ahead!
msg189777 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-21 19:02
New changeset 155e6fb309f5 by Giampaolo Rodola' in branch 'default':
Fix issue #17996: expose socket.AF_LINK constant on BSD and OSX.
http://hg.python.org/cpython/rev/155e6fb309f5
History
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62196
2013-05-21 19:03:12giampaolo.rodolasetstatus: open -> closed
assignee: giampaolo.rodola
type: enhancement
resolution: fixed
stage: resolved
2013-05-21 19:02:15python-devsetnosy: + python-dev
messages: + msg189777
2013-05-21 14:09:17neologixsetmessages: + msg189757
2013-05-21 01:14:28giampaolo.rodolasetfiles: + AF_LINK.patch
keywords: + patch
messages: + msg189716
2013-05-21 00:27:39giampaolo.rodolasetmessages: + msg189715
2013-05-19 08:20:05neologixsetmessages: + msg189572
2013-05-17 05:53:22pitrousetnosy: + neologix
2013-05-17 02:20:43giampaolo.rodolacreate