[Patches] [Patch #101137] Add raw packet support to socketmodule.c

noreply@sourceforge.net noreply@sourceforge.net
Thu, 01 Feb 2001 19:23:41 -0800


Patch #101137 has been updated. 

Project: python
Category: Modules
Status: Accepted
Submitted by: grante
Assigned to : jhylton
Summary: Add raw packet support to socketmodule.c

Follow-Ups:

Date: 2001-Feb-01 19:23
By: jhylton

Comment:
checked in as rev 1.134

Grant-- Could you supply a short example that demonstrates how to use raw
sockets?  We can't really include the code in the test suite, since you
need to be root to use them, but perhaps in the Demo directory.

-------------------------------------------------------

Date: 2001-Jan-27 17:02
By: grante

Comment:
Revised patch:
1) fixed indentation style.
2) fixed possible strncpy buffer overrun.
3) fixed bug in getsockname.
4) exposed sll_pkttype and sll_hatype fields of
   sockaddr_ll struct (AFAICT, they're not useful).
5) changed conditional compilation so AF_PACKET stuff
   is only built under Linux.

(patch is against 2.0)
-------------------------------------------------------

Date: 2001-Jan-18 10:01
By: nobody

Comment:
Yes, I'm still interested in this patch.  Winthin the next week or two I'll
try to get a revised patch submitted that
addresses some of the comments.

Two things I can't do much about are:

1) I only have Linux systems for testing: I don't have
root privledges on any other type of system.

2) Unless it is agreed to change parameters for    makesockaddr, I can't do
anything except create a
temporary socket in order to look up the interface
name.  I suppose I could require user code to provide
an interface index, but I don't really like that option
since it diverges quite a bit from the "C" usage.

-------------------------------------------------------

Date: 2001-Jan-18 09:39
By: jhylton

Comment:
Is Grant still interested in this patch?  I don't have time to fix 
it myself, but I would be happy to look at it again if we comments
and questions are addressed.


-------------------------------------------------------

Date: 2000-Aug-09 14:49
By: grante

Comment:
Patch has only been tested on Linux: RH6.2 (Intel).

Patch is against 1.6b1

-------------------------------------------------------

Date: 2000-Aug-15 15:15
By: tim_one

Comment:
Assigned to Barry, since he just volunteered to rewrite all of Python's
socket code anyway <wink>.
-------------------------------------------------------

Date: 2000-Aug-24 14:27
By: jhylton

Comment:
Not sure about this patch.  It needs to be tested on more platforms than
just Linux, but I don't see that we'll have time before 2.0.  There are
several other issues that must be resolved, too.  Thus, this patch falls
subject to the feature freeze.

Style points: Indention is wrong.  The opening curly brace of an if
belongs on the same line as the test.  Whitespace is required around =
and after commas in argument lists.

The strncpy in makesockaddr does not check the size of the source
string.  It could overflow the buffer.

In makesockaddr, a new socket is created just to look up the interface
name associated with a particular interface.  This seems wasteful,
particularly in cases where few file descriptors are available.  I'm
not sure what the solution is, although it might be to change the
makesockaddr function so that it takes the socket itself.  Perhaps
that socket address for AF_PACKET should also accept and/or produce
interface numbers which the client can convert to names manually.

The sockaddr_ll has members ssl_hatype and ssl_pkttype, which are not
made accessible by this patch.  It seems like they should be, but I am
not sure.  Can you use SOCK_DGRAM without specifying the packet type?

getsockaddrarg is handled, but getsockaddrlen is not.

Question: Are there any other constants that should be added?  This
relates to the packet type question.


* 
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101137&group_id=5470