PATCH/RFC for AF_NETLINK support
Hi,
I've done a small patch to use linux AF_NETLINK sockets (see below).
Please comment!
Is there a reason for recvmsg() and sendmsg() not to be implemented
yet in socketmodule ?
The integration with autoconf has not been done, even if
this patch should be ok :
--- configure.in.ori 2005-01-10 17:09:32.000000000 +0100
+++ configure.in 2005-01-06 18:53:18.000000000 +0100
@@ -967,7 +967,7 @@
sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \
sys/modem.h \
sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
-sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
+sys/un.h linux/netlink.h sys/utsname.h sys/wait.h pty.h libutil.h \
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
bluetooth/bluetooth.h)
AC_HEADER_DIRENT
--- pyconfig.h.ori 2005-01-10 17:11:11.000000000 +0100
+++ pyconfig.h 2005-01-06 19:27:33.000000000 +0100
@@ -559,6 +559,9 @@
/* Define to 1 if you have the
On Mon, Jan 10, 2005 at 05:17:49PM +0100, Philippe Biondi wrote:
I've done a small patch to use linux AF_NETLINK sockets (see below). Please comment!
As of 2.6.10, a very useful new netlink family was merged - NETLINK_KOBJECT_UEVENT. I'd imagine quite a lot of interest from Python developers for NETLINK support will come from this new interface in the coming years. http://lwn.net/Articles/101210/ http://lkml.org/lkml/2004/9/10/315 http://vrfy.org/projects/kevents/ http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.10 I would like to see (optional?) support for this before your patch is merged. I have a long-term interest in a Python-based service control / init replacement / system management application, for use in specialised environments. I could definately use this. :) Thanks, David. -- Harmless - and in its harmlessness, diabolical. -- The Mold Of Yancy (Philip K. Dick)
On Tue, 11 Jan 2005 01:32:52 +0000, David Wilson
On Mon, Jan 10, 2005 at 05:17:49PM +0100, Philippe Biondi wrote:
I've done a small patch to use linux AF_NETLINK sockets (see below). Please comment!
As of 2.6.10, a very useful new netlink family was merged - NETLINK_KOBJECT_UEVENT. I'd imagine quite a lot of interest from Python developers for NETLINK support will come from this new interface in the coming years.
[snip]
I would like to see (optional?) support for this before your patch is merged. I have a long-term interest in a Python-based service control / init replacement / system management application, for use in specialised environments. I could definately use this. :)
Useful indeed, but I'm not sure why basic NETLINK support should be held up for it? Jp
On Tue, Jan 11, 2005 at 02:15:23PM +0000, Jp Calderone wrote:
I would like to see (optional?) support for this before your patch is merged. I have a long-term interest in a Python-based service control / init replacement / system management application, for use in specialised environments. I could definately use this. :)
Useful indeed, but I'm not sure why basic NETLINK support should be held up for it?
Point taken. I don't recall why I thought special code would be required
for this.
I was thinking a little more about how support might be added for older
kernels. No harm can be done by compiling in the constant, and it
doesn't cost much. How about:
#include
Philippe Biondi wrote:
I've done a small patch to use linux AF_NETLINK sockets (see below). Please comment!
I have a high-level comment - python-dev is normally the wrong place for patches; please submit them to sf.net/projects/python instead. Apart from that, the patch looks fine.
Is there a reason for recvmsg() and sendmsg() not to be implemented yet in socketmodule ?
I'm not sure what you mean by "implemented": these functions are implemented by the operating system, not in the socketmodule. If you ask "why are they not exposed to Python yet?": There has been no need to do so, so far. What do I get with recvmsg that I cannot get with recv/recvfrom just as well? Regards, Martin
On Tue, 11 Jan 2005, [ISO-8859-1] "Martin v. Löwis" wrote:
Philippe Biondi wrote:
I've done a small patch to use linux AF_NETLINK sockets (see below). Please comment!
I have a high-level comment - python-dev is normally the wrong place for patches; please submit them to sf.net/projects/python instead.
OK, I'll post it here.
Apart from that, the patch looks fine.
Fine!
Is there a reason for recvmsg() and sendmsg() not to be implemented yet in socketmodule ?
I'm not sure what you mean by "implemented": these functions are implemented by the operating system, not in the socketmodule.
If you ask "why are they not exposed to Python yet?": There has been no need to do so, so far. What do I get with recvmsg that I cannot get with recv/recvfrom just as well?
You can have access to ancillary messages. You can, for example transmit
credentials or file descriptors through unix sockets, which is very
interesting for privilege separation.
--
Philippe Biondi
On Tue, 11 Jan 2005 08:54:42 +0100, "\"Martin v. Löwis\""
Philippe Biondi wrote:
I've done a small patch to use linux AF_NETLINK sockets (see below). Please comment!
I have a high-level comment - python-dev is normally the wrong place for patches; please submit them to sf.net/projects/python instead.
Apart from that, the patch looks fine.
Is there a reason for recvmsg() and sendmsg() not to be implemented yet in socketmodule ?
I'm not sure what you mean by "implemented": these functions are implemented by the operating system, not in the socketmodule.
If you ask "why are they not exposed to Python yet?": There has been no need to do so, so far. What do I get with recvmsg that I cannot get with recv/recvfrom just as well?
Everything that recvmsg() does. recv() and recvfrom() give you "regular" bytes - data sent to the socket using send() or sendto(). recvmsg() gives you messages - data sent to the socket using sendmsg(). There is no way to receive messages by using recv() or recvfrom() (and no way to send them using send() or sendto()). Inversely, I believe send() and recv() can be implemented in terms of sendmsg() and recvmsg(). Perhaps we should get rid of socket.send() and socket.recv()? <wink> Other things that sendmsg() and recvmsg() can do include passing file descriptors, receiving notice of OOB TCP data, peek at bytes from the kernel's buffer without actually reading them, and implement scatter/gather IO functions (although you'd probably just want to wrap and use writev() and readv() instead). Jp
participants (5)
-
"Martin v. Löwis"
-
David Wilson
-
David Wilson
-
Jp Calderone
-
Philippe Biondi