Issue 947352: AF_PACKET Hardware address support in socket module (original) (raw)

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

Files
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 struct. 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 user_id=11375 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 you.
msg45934 - (view) Author: Jason Andryuk (thedeuce) Date: 2004-07-15 18:30
Logged In: YES user_id=1034404 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 user_id=11375 Thanks for the confirmation; marking this as closed.
History
Date User Action Args
2022-04-11 14:56:03 admin set github: 40211
2004-05-03 23:36:11 thedeuce create