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.

Title: AF_PACKET Hardware address support in socket module
Type: Stage:
Components: Extension Modules Versions: Python 2.4
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, thedeuce
Priority: normal Keywords: patch

Created on 2004-05-03 23:36 by thedeuce, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
python-af_packet.patch thedeuce, 2004-05-03 23:36 Modules/socketmodule.c patch to enable more AF_PACKET options
Messages (4)
msg45932 - (view) Author: Jason Andryuk (thedeuce) Date: 2004-05-03 23:36
The current implementation of AF_PACKET only uses the
device name and protocol options even when a 5-tuple of
Device, Protocol, Packet Type, Hardware Type, and
Hardware Address are supplied.  I needed
socket.sendto() to support sending to a Hardware
Address, so this patch supports such functionality.

The length check on the hardware address is hard coded
to 8 since that is the value used in the sockaddr_ll

I'm not that familiar with the Python internals, so
s->errorhandler() may not be the best call to make for
an invalid hardware address length.
msg45933 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-07-10 23:40
Logged In: YES 

Checked in to CVS HEAD; thanks for the patch!

I think s_errorhandler is only when you're trying to report the error from a 
system call; I changed to raise a ValueError if the hardware address is too 
long.  Please give the CVS version a try and let me know if it works for 
msg45934 - (view) Author: Jason Andryuk (thedeuce) Date: 2004-07-15 18:30
Logged In: YES 

Yeah, ValueError looks good, and it sends out packets to the
desired address just fine.

Thank You
msg45935 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-07-15 19:08
Logged In: YES 

Thanks for the confirmation; marking this as closed.
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40211
2004-05-03 23:36:11thedeucecreate